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.
C# audio-converteravaloniabatch-conversionconvertercsharpdocument-converterdocx-to-pdfdotnetdrag-and-dropfile-conversionfile-converterheic-converterhwphwpximage-converterlinuxmacospdf-convertervideo-converterwindows
macOS: package signs, tests pass, a clear alert when no window can open
KnifeLemon574363695d57
diff --git a/.gitattributes b/.gitattributesindex 603fb607..6eda92c5 100644--- a/.gitattributes+++ b/.gitattributes@@ -6,6 +6,7 @@*.md text*.ps1 text eol=crlf*.sh text eol=lf+*.plist text eol=lf*.ttf binary*.otf binarydiff --git a/build/build-portable.ps1 b/build/build-portable.ps1index f82317a5..b56f639a 100644--- a/build/build-portable.ps1+++ b/build/build-portable.ps1@@ -87,13 +87,15 @@ if ($Runtime.StartsWith('osx-')) {$entitlements = Join-Path $root 'installer/macos/entitlements.plist'$signOptions = @('--force', '--sign', $SigningIdentity)if ($SigningIdentity -ne '-') { $signOptions += @('--timestamp', '--options', 'runtime') }- foreach ($file in Get-ChildItem -LiteralPath $publish -Recurse -File | Sort-Object { $_.FullName.Length } -Descending) {- $format = & /usr/bin/file --brief $file.FullName- if ($LASTEXITCODE -ne 0) { throw "Cannot inspect $($file.FullName) before signing." }- if ($format -match 'Mach-O') {- Invoke-Checked 'Sign native binary' { codesign @signOptions --entitlements $entitlements $file.FullName }- }+ # Every file in Contents/MacOS is code to codesign, the .NET assemblies too (their signature goes into extended+ # attributes): signing the main executable checks all of them. Deepest paths first, the main executable last.+ $mainExecutable = Join-Path $publish 'Filee'+ $files = Get-ChildItem -LiteralPath $publish -Recurse -File | Where-Object { $_.FullName -ne $mainExecutable } |+ Sort-Object { $_.FullName.Length } -Descending+ foreach ($file in $files) {+ Invoke-Checked "Sign $($file.Name)" { codesign @signOptions --entitlements $entitlements $file.FullName }}+ Invoke-Checked 'Sign main executable' { codesign @signOptions --entitlements $entitlements $mainExecutable }Invoke-Checked 'Sign app bundle' { codesign @signOptions --entitlements $entitlements $appBundle }Invoke-Checked 'Verify app signature' { codesign --verify --deep --strict $appBundle }Copy-Item -LiteralPath (Join-Path $root 'installer/macos/install.sh') -Destination $packagediff --git a/src/Filee.App/Program.cs b/src/Filee.App/Program.csindex 06872003..b09b51d7 100644--- a/src/Filee.App/Program.cs+++ b/src/Filee.App/Program.cs@@ -41,6 +41,15 @@ internal static class Program{return BuildAvaloniaApp().StartWithClassicDesktopLifetime(args, ShutdownMode.OnExplicitShutdown);}+ catch (InvalidOperationException ex) when (OperatingSystem.IsMacOS() && ex.Message.Contains("RenderTimer", StringComparison.Ordinal))+ {+ // The window system has no display link for this screen: a Mac in a virtual machine without graphics+ // acceleration (VMware). Avalonia can't draw there; say so instead of quitting without a word.+ StartupFailure.Report(ex, "Filee can't open its window on this Mac: macOS reports no display it can draw on. " ++ "This happens in virtual machines without graphics acceleration (such as VMware). " ++ "The filee command still works in Terminal.");+ return 1;+ }finally{Instance.Dispose();diff --git a/src/Filee.App/StartupFailure.cs b/src/Filee.App/StartupFailure.csnew file mode 100644index 00000000..42b92ccf--- /dev/null+++ b/src/Filee.App/StartupFailure.cs@@ -0,0 +1,46 @@+// A start that fails before any window exists (Avalonia could not initialise): written to the log and shown in a+// system alert, since Filee has no window of its own to show it in.++using System.Diagnostics;+using Filee.Core.Settings;++namespace Filee.App;++internal static class StartupFailure+{+ public static void Report(Exception exception, string message)+ {+ try+ {+ var logs = Path.Combine(UserDataStore.DefaultDirectory, "logs");+ Directory.CreateDirectory(logs);+ File.AppendAllText(Path.Combine(logs, $"filee-{DateTime.Now:yyyyMMdd}.log"),+ $"{DateTime.Now:yyyy-MM-dd HH:mm:ss} [Error] Startup: {message}{Environment.NewLine}{exception}{Environment.NewLine}");+ }+ catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)+ {+ }++ if (!OperatingSystem.IsMacOS())+ return;+ try+ {+ // osascript shows the alert even though this process has no window; the text goes in as an argument.+ using var alert = Process.Start(new ProcessStartInfo("/usr/bin/osascript")+ {+ ArgumentList =+ {+ "-e", "on run argv",+ "-e", "display alert \"Filee\" message (item 1 of argv) as critical buttons {\"OK\"}",+ "-e", "end run",+ message,+ },+ UseShellExecute = false,+ });+ alert?.WaitForExit(TimeSpan.FromMinutes(10));+ }+ catch (Exception ex) when (ex is System.ComponentModel.Win32Exception or InvalidOperationException)+ {+ }+ }+}diff --git a/src/Filee.Engines/Infrastructure/CopyVersions.cs b/src/Filee.Engines/Infrastructure/CopyVersions.csindex dc4e6610..b8c94298 100644--- a/src/Filee.Engines/Infrastructure/CopyVersions.cs+++ b/src/Filee.Engines/Infrastructure/CopyVersions.cs@@ -13,7 +13,13 @@ public static partial class CopyVersionsprivate static readonly ConcurrentDictionary<string, Version?> Cache = new();/// <summary>The version Filee is tested with ("9.0"), from engines.json; null for unknown packages.</summary>- public static Version? Expected(string id) => Parse(EngineVersions.Component(id));+ // Where Filee offers no download (FFmpeg and Ghostscript on macOS come from Homebrew), the version it is tested+ // with is the one the Windows list names, so an older copy still gets "update recommended".+ public static Version? Expected(string id) =>+ Parse(EngineVersions.Component(id) ?? ReferenceComponents.Value.GetValueOrDefault(id)?.Version);++ private static readonly Lazy<IReadOnlyDictionary<string, EngineComponent>> ReferenceComponents =+ new(() => EngineDownloads.ComponentsForRuntime("win-x64"));/// <summary>/// The version of the copy in <paramref name="folder"/> (major.minor), or null when it can't be told (e.g. andiff --git a/tests/Filee.App.Tests/ExplorerMenuTests.cs b/tests/Filee.App.Tests/ExplorerMenuTests.csindex c6ed47d6..d1df752d 100644--- a/tests/Filee.App.Tests/ExplorerMenuTests.cs+++ b/tests/Filee.App.Tests/ExplorerMenuTests.cs@@ -93,6 +93,7 @@ public class ExplorerMenuTests[Fact]public void Every_native_import_exists_in_the_dll_it_names(){+ Assert.SkipUnless(OperatingSystem.IsWindows(), "Windows only.");// GetPackagePathByFullName2 was imported from kernel32.dll, which doesn't export it: the call only failed// once a package was registered and crashed the app right after "Add to the main menu" (1.1.0).var nativeMethods = typeof(ExplorerMenuRegistration).Assembly.GetType("Filee.Platform.Windows.NativeMethods", throwOnError: true)!;@@ -112,6 +113,7 @@ public class ExplorerMenuTests[Fact]public void Reading_the_registered_package_never_throws(){+ Assert.SkipUnless(OperatingSystem.IsWindowsVersionAtLeast(10), "Package APIs need Windows.");Assert.Null(ExplorerMenuRegistration.ExternalLocationOf("Filee.NotInstalled_1.0.0.0_x64__0000000000000"));// Whatever is registered on this machine (nothing on CI): a registered sparse package has an external location.if (ExplorerMenuRegistration.Find() is { } package)diff --git a/tests/Filee.App.Tests/RenderTests.cs b/tests/Filee.App.Tests/RenderTests.csindex 09128aca..ca1d6424 100644--- a/tests/Filee.App.Tests/RenderTests.cs+++ b/tests/Filee.App.Tests/RenderTests.cs@@ -176,7 +176,8 @@ public class RenderTests// Everything not installed is offered; small downloads are pre-selected, the large LibreOffice, FFmpeg and calibre and the// EPS-only Ghostscript not.- Assert.All(vm.Packages.Where(p => !p.IsInstalled), p => Assert.Equal(+ // (On macOS FFmpeg and Ghostscript come from Homebrew: listed, but not offered for download.)+ Assert.All(vm.Packages.Where(p => !p.IsInstalled && p.CanInstall), p => Assert.Equal(Filee.Engines.Infrastructure.EngineDownloads.DownloadSize(p.Package) < Filee.Engines.Infrastructure.EngineDownloads.SuggestLimit&& p.Package.Id != "ghostscript", p.Selected));Assert.DoesNotContain(vm.Packages, p => p.Package.Id is "libreoffice" or "ffmpeg" or "calibre" or "ghostscript" && p.Selected);diff --git a/tests/Filee.Engines.Tests/ArchiveTests.cs b/tests/Filee.Engines.Tests/ArchiveTests.csindex 76d30c2d..25b25aaf 100644--- a/tests/Filee.Engines.Tests/ArchiveTests.cs+++ b/tests/Filee.Engines.Tests/ArchiveTests.cs@@ -584,7 +584,9 @@ public class ArchiveTests(EngineFixture fx) : IClassFixture<EngineFixture>[Fact]public void Clashing_names_in_one_archive_are_numbered(){- var items = ArchiveConverter.UniqueEntries([@"C:\a\x.txt", @"C:\b\X.txt", @"C:\c\x.txt", @"C:\d\y"]);+ var root = Path.GetTempPath();+ var items = ArchiveConverter.UniqueEntries([Path.Combine(root, "a", "x.txt"), Path.Combine(root, "b", "X.txt"),+ Path.Combine(root, "c", "x.txt"), Path.Combine(root, "d", "y")]);Assert.Equal(["x.txt", "X (2).txt", "x (3).txt", "y"], items.Select(i => i.EntryName));}diff --git a/tests/Filee.Engines.Tests/EmlTests.cs b/tests/Filee.Engines.Tests/EmlTests.csindex 5a4714fd..107be91f 100644--- a/tests/Filee.Engines.Tests/EmlTests.cs+++ b/tests/Filee.Engines.Tests/EmlTests.cs@@ -157,7 +157,7 @@ public class EmlTests(EngineFixture fx) : IClassFixture<EngineFixture>var html = await File.ReadAllTextAsync(await ConvertAsync(path, "html"), TestContext.Current.CancellationToken);Assert.Contains("<title>한글 제목</title>", html);- Assert.Contains("<pre class=\"filee-mail-text\">본문 <첫 줄>\r\n둘째 줄", html);+ Assert.Contains("<pre class=\"filee-mail-text\">본문 <첫 줄>\n둘째 줄", html.ReplaceLineEndings("\n"));Assert.DoesNotContain("Attachments", html);// No attachments: a clear error instead of an empty ZIP.diff --git a/tests/Filee.Engines.Tests/FontTests.cs b/tests/Filee.Engines.Tests/FontTests.csindex c55e8130..8ef64762 100644--- a/tests/Filee.Engines.Tests/FontTests.cs+++ b/tests/Filee.Engines.Tests/FontTests.cs@@ -210,8 +210,9 @@ public class FontTests(EngineFixture fx) : IClassFixture<EngineFixture>using var ttfFont = new SKFont(ttfFace, 1000) { Hinting = SKFontHinting.None };for (ushort gid = 0; gid < glyphs.Length; gid++){- using var expected = cffFont.GetGlyphPath(gid);- using var actual = ttfFont.GetGlyphPath(gid);+ // macOS's font backend gives no path at all (null) for an empty glyph.+ using var expected = cffFont.GetGlyphPath(gid) ?? new SKPath();+ using var actual = ttfFont.GetGlyphPath(gid) ?? new SKPath();Assert.Equal(expected.IsEmpty, actual.IsEmpty);if (expected.IsEmpty)continue;