Skip to content

armgit / Filee

Public Imported from GitHub
0

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

Offer the x64 engine downloads on Windows 11 on ARM64

KnifeLemon20d39b698bc9
diff --git a/docs/ENGINES.md b/docs/ENGINES.md
index 4513562e..68b044e4 100644
--- a/docs/ENGINES.md
+++ b/docs/ENGINES.md
@@ -169,7 +169,9 @@ pinned source in `build/build-native.py` like rhwp (PR #113 did this for SharpHo
`build/build-installer.ps1 -Runtime win-arm64` builds `Filee-<version>-win-arm64-Setup.exe` (and `-Portable.zip`): the
app, the command line and Setup for win-arm64, the Explorer menu DLL for ARM64 (`build-explorer-menu.ps1
-Architecture arm64`, packaged as `arm64`), and ARM64 builds of the bundled engines (`fetch-engines.ps1 -Runtime
-win-arm64`). The engines the app downloads stay x64; Windows 11 on ARM runs them under emulation.
+win-arm64`). The engines the app downloads stay x64: on Windows 11 on ARM, which runs them under emulation, the app
+offers the win-x64 downloads (`EngineDownloads.DownloadRuntime`); Windows 10 on ARM can't run them and gets none.
+Setup's engine list is made when it is packed (`build/tools/make-setup.cs`), so the ARM64 Setup offers the x64 one.
- **7-Zip**: the official ARM64 installer of the version engines.json pins, a 7z self-extracting archive unpacked by
the x64 7-Zip (Windows' `tar.exe` can't undo its ARM64 executable filter).
diff --git a/src/Filee.Engines/Infrastructure/EngineDownloads.cs b/src/Filee.Engines/Infrastructure/EngineDownloads.cs
index 343a7ea9..d4a90413 100644
--- a/src/Filee.Engines/Infrastructure/EngineDownloads.cs
+++ b/src/Filee.Engines/Infrastructure/EngineDownloads.cs
@@ -31,7 +31,16 @@ public static class EngineDownloads
/// download is left out, so the package is offered like one Filee has no download of.
/// </summary>
public static IReadOnlyDictionary<string, EngineComponent> Components { get; } =
- ComponentsForRuntime(RuntimeIdentifier, OperatingSystem.IsMacOS() ? Environment.OSVersion.Version : null);
+ ComponentsForRuntime(DownloadRuntime(RuntimeIdentifier, OperatingSystem.IsWindows() ? Environment.OSVersion.Version.Build : 0),
+ OperatingSystem.IsMacOS() ? Environment.OSVersion.Version : null);
+
+ /// <summary>
+ /// The downloads a Windows build runs: Filee has no ARM64 builds of the engines it downloads, and Windows 11 on ARM64
+ /// (build 22000 and later) runs the x64 ones under emulation, so win-arm64 gets the win-x64 list there. Windows 10 on
+ /// ARM64 can't run x64 programs and gets none. The bundled rhwp and 7-Zip are ARM64 builds of the same versions.
+ /// </summary>
+ internal static string DownloadRuntime(string runtimeIdentifier, int windowsBuild) =>
+ runtimeIdentifier == "win-arm64" && windowsBuild >= 22000 ? "win-x64" : runtimeIdentifier;
/// <summary>
/// Packages offered in Settings → Engines and on first run. rhwp and 7-Zip are not listed: they are small and bundled.
diff --git a/tests/Filee.Engines.Tests/PortableEngineTests.cs b/tests/Filee.Engines.Tests/PortableEngineTests.cs
index 8903c05f..5a3b3e5c 100644
--- a/tests/Filee.Engines.Tests/PortableEngineTests.cs
+++ b/tests/Filee.Engines.Tests/PortableEngineTests.cs
@@ -55,6 +55,18 @@ public sealed class PortableEngineTests : IDisposable
public void Unknown_platforms_cannot_fall_back_to_Windows_downloads() =>
Assert.Empty(EngineDownloads.ComponentsForRuntime("linux-riscv64"));
+ [Theory]
+ [InlineData("win-arm64", 26100, "win-x64")] // Windows 11 on ARM runs the x64 downloads under emulation
+ [InlineData("win-arm64", 22000, "win-x64")]
+ [InlineData("win-arm64", 19045, "win-arm64")] // Windows 10 on ARM can't: no downloads
+ [InlineData("win-x64", 19045, "win-x64")]
+ [InlineData("linux-arm64", 0, "linux-arm64")]
+ public void Windows_on_ARM64_downloads_the_x64_engines_from_Windows_11_on(string runtime, int build, string downloads)
+ {
+ Assert.Equal(downloads, EngineDownloads.DownloadRuntime(runtime, build));
+ Assert.Empty(EngineDownloads.ComponentsForRuntime("win-arm64"));
+ }
+
[Theory]
[InlineData("libreoffice", "LibreOffice.app/Contents/MacOS", "soffice")]
[InlineData("calibre", "calibre.app/Contents/MacOS", "ebook-convert")]