From 12f26445ba584c42d33364aa0c07769f79f65bb7 Mon Sep 17 00:00:00 2001 From: Carsten Bauer Date: Fri, 13 Nov 2026 10:34:30 +0100 Subject: [PATCH] Fixed the Pdfium install on a fresh clone without runtime/target (#1195) Co-authored-by: Thorsten Sommer --- app/Build/Commands/Pdfium.cs | 20 ++++++++++--------- .../Assistants/I18N/allTexts.lua | 3 +++ app/MindWork AI Studio/Pages/Supporters.razor | 1 + .../plugin.lua | 3 +++ .../plugin.lua | 3 +++ 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/app/Build/Commands/Pdfium.cs b/app/Build/Commands/Pdfium.cs index b1550d9b4..9498dff91 100644 --- a/app/Build/Commands/Pdfium.cs +++ b/app/Build/Commands/Pdfium.cs @@ -9,7 +9,7 @@ namespace Build.Commands; public static class Pdfium { - private const int MAX_DOWNLOAD_ATTEMPTS = 3; + private const int MAX_INSTALL_ATTEMPTS = 3; private static readonly TimeSpan CONNECT_TIMEOUT = TimeSpan.FromSeconds(30); private static readonly TimeSpan RESPONSE_TIMEOUT = TimeSpan.FromSeconds(60); @@ -77,7 +77,7 @@ public static class Pdfium return; } - for (var attempt = 1; attempt <= MAX_DOWNLOAD_ATTEMPTS; attempt++) + for (var attempt = 1; attempt <= MAX_INSTALL_ATTEMPTS; attempt++) { try { @@ -88,7 +88,7 @@ public static class Pdfium catch (Exception exception) when (IsTransientFailure(exception)) { Console.Write($" failed: {DescribeFailure(exception)}"); - if (attempt < MAX_DOWNLOAD_ATTEMPTS) + if (attempt < MAX_INSTALL_ATTEMPTS) { Console.Write($" Retrying in {RETRY_DELAY.TotalSeconds:0} seconds ..."); await Task.Delay(RETRY_DELAY); @@ -97,7 +97,7 @@ public static class Pdfium } Console.WriteLine(); - Console.WriteLine($"- Error: Could not download Pdfium {version} for {rid.UserFriendlyName} from {pdfiumUrl} in {MAX_DOWNLOAD_ATTEMPTS} attempts."); + Console.WriteLine($"- Error: Could not install Pdfium {version} for {rid.UserFriendlyName} from {pdfiumUrl} in {MAX_INSTALL_ATTEMPTS} attempts."); if (File.Exists(pdfiumLibTargetPath)) Console.WriteLine(" To build with the library which is already present, use --offline."); @@ -172,12 +172,14 @@ public static class Pdfium // // Deploy the library. The marker goes first, so that it never describes a library - // which was only half replaced: + // which was only half replaced. The directory of the marker does not exist before the + // first Rust build, which comes after this step on a fresh clone, and File.Delete + // throws when a directory is missing: // Console.Write(" deploying ..."); + Directory.CreateDirectory(Path.GetDirectoryName(versionMarkerPath)!); File.Delete(versionMarkerPath); File.Move(pdfiumLibTmpTargetPath, pdfiumLibTargetPath, true); - Directory.CreateDirectory(Path.GetDirectoryName(versionMarkerPath)!); await File.WriteAllTextAsync(versionMarkerPath, versionMarker, Environment.UTF8_NO_BOM); } catch (OperationCanceledException) when (attemptTimeout.IsCancellationRequested) @@ -199,14 +201,14 @@ public static class Pdfium } /// - /// Whether another attempt may succeed where a download attempt failed with the given exception. + /// Whether another attempt may succeed where an attempt to install the library failed with the given exception. /// /// The exception the attempt failed with. - /// True, when the download is worth another attempt. + /// True, when the installation is worth another attempt. private static bool IsTransientFailure(Exception exception) => exception is HttpRequestException or OperationCanceledException or TimeoutException or IOException or InvalidDataException; /// - /// Describes why a download attempt failed, in one line. + /// Describes why an attempt to install the library failed, in one line. /// /// /// The innermost exception names the actual cause, such as the socket error behind an HttpRequestException diff --git a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua index 643062d7c..11f072a7f 100644 --- a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua +++ b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua @@ -17410,6 +17410,9 @@ UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2640760894"] = "Become one of our -- Become one of our titans UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2640760894::INFORMAL"] = "Become one of our titans" +-- Thank you, Carsten, for fixing the first build after a fresh clone of AI Studio. +UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2698568606"] = "Thank you, Carsten, for fixing the first build after a fresh clone of AI Studio." + -- Supporters UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2929332068"] = "Supporters" diff --git a/app/MindWork AI Studio/Pages/Supporters.razor b/app/MindWork AI Studio/Pages/Supporters.razor index c02b41a50..f74c4591b 100644 --- a/app/MindWork AI Studio/Pages/Supporters.razor +++ b/app/MindWork AI Studio/Pages/Supporters.razor @@ -101,6 +101,7 @@ + diff --git a/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua b/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua index 1f28741b4..f847da826 100644 --- a/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua +++ b/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua @@ -17412,6 +17412,9 @@ UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2640760894"] = "Werden Sie einer -- Become one of our titans UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2640760894::INFORMAL"] = "Werde einer unserer Titanen" +-- Thank you, Carsten, for fixing the first build after a fresh clone of AI Studio. +UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2698568606"] = "Vielen Dank, Carsten, dass du den ersten Build nach einem frischen Klon von AI Studio repariert hast." + -- Supporters UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2929332068"] = "Unterstützer" diff --git a/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua b/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua index f68364b53..4f5212c5a 100644 --- a/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua +++ b/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua @@ -17412,6 +17412,9 @@ UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2640760894"] = "Become one of our -- Become one of our titans UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2640760894::INFORMAL"] = "Become one of our titans" +-- Thank you, Carsten, for fixing the first build after a fresh clone of AI Studio. +UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2698568606"] = "Thank you, Carsten, for fixing the first build after a fresh clone of AI Studio." + -- Supporters UI_TEXT_CONTENT["AISTUDIO::PAGES::SUPPORTERS::T2929332068"] = "Supporters"