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.

Finder and the file manager by name on macOS and Linux; HWPX read-back tests run on Linux ARM64

KnifeLemonaae7195a1018
diff --git a/src/Filee.App/Assets/i18n/en.json b/src/Filee.App/Assets/i18n/en.json
index 737798df..8a979539 100644
--- a/src/Filee.App/Assets/i18n/en.json
+++ b/src/Filee.App/Assets/i18n/en.json
@@ -22,6 +22,8 @@
"home.title": "Home",
"home.drop_title": "Drop files here",
"home.drop_hint": "Or hold {0} while dragging files in Explorer. The donut toolbar opens at your cursor.",
+ "home.drop_hint_macos": "Or hold {0} while dragging files in Finder. The donut toolbar opens at your cursor.",
+ "home.drop_hint_linux": "Or hold {0} while dragging files in your file manager. The donut toolbar opens at your cursor.",
"home.recent": "Recent conversions",
"home.recent_empty": "Your converted files will show up here.",
"home.open_folder": "Open folder",
@@ -208,6 +210,8 @@
"triggers.hold_ms": "Hold time",
"triggers.scope": "Active in",
"triggers.scope.FileManager": "Explorer and desktop",
+ "triggers.scope.FileManager_macos": "Finder and desktop",
+ "triggers.scope.FileManager_linux": "File manager and desktop",
"triggers.scope.Anywhere": "Everywhere",
"triggers.excluded": "Never trigger in these apps",
"triggers.excluded_hint": "Process names separated by commas, e.g. photoshop, code",
diff --git a/src/Filee.App/Assets/i18n/ko.json b/src/Filee.App/Assets/i18n/ko.json
index 5b61fe5e..251d48a1 100644
--- a/src/Filee.App/Assets/i18n/ko.json
+++ b/src/Filee.App/Assets/i18n/ko.json
@@ -22,6 +22,8 @@
"home.title": "홈",
"home.drop_title": "여기에 파일을 놓으세요",
"home.drop_hint": "또는 탐색기에서 {0} 키를 누른 채 파일을 드래그하면 커서 위치에 원형 툴바가 열려요.",
+ "home.drop_hint_macos": "또는 Finder에서 {0} 키를 누른 채 파일을 드래그하면 커서 위치에 원형 툴바가 열려요.",
+ "home.drop_hint_linux": "또는 파일 관리자에서 {0} 키를 누른 채 파일을 드래그하면 커서 위치에 원형 툴바가 열려요.",
"home.recent": "최근 변환",
"home.recent_empty": "변환한 파일이 여기에 표시됩니다.",
"home.open_folder": "폴더 열기",
@@ -208,6 +210,8 @@
"triggers.hold_ms": "누르는 시간",
"triggers.scope": "동작 범위",
"triggers.scope.FileManager": "탐색기와 바탕화면",
+ "triggers.scope.FileManager_macos": "Finder와 데스크탑",
+ "triggers.scope.FileManager_linux": "파일 관리자와 바탕화면",
"triggers.scope.Anywhere": "모든 곳",
"triggers.excluded": "이 앱에서는 동작하지 않기",
"triggers.excluded_hint": "프로세스 이름을 쉼표로 구분, 예: photoshop, code",
diff --git a/src/Filee.App/Assets/i18n/zh-CN.json b/src/Filee.App/Assets/i18n/zh-CN.json
index 191d16bf..92dc0c89 100644
--- a/src/Filee.App/Assets/i18n/zh-CN.json
+++ b/src/Filee.App/Assets/i18n/zh-CN.json
@@ -22,6 +22,8 @@
"home.title": "首页",
"home.drop_title": "将文件拖放到这里",
"home.drop_hint": "或在资源管理器中按住 {0} 拖动文件,环形工具栏会在光标处打开。",
+ "home.drop_hint_macos": "或在访达中按住 {0} 拖动文件,环形工具栏会在光标处打开。",
+ "home.drop_hint_linux": "或在文件管理器中按住 {0} 拖动文件,环形工具栏会在光标处打开。",
"home.recent": "最近的转换",
"home.recent_empty": "转换后的文件会显示在这里。",
"home.open_folder": "打开文件夹",
@@ -208,6 +210,8 @@
"triggers.hold_ms": "按住时间",
"triggers.scope": "生效范围",
"triggers.scope.FileManager": "资源管理器和桌面",
+ "triggers.scope.FileManager_macos": "访达和桌面",
+ "triggers.scope.FileManager_linux": "文件管理器和桌面",
"triggers.scope.Anywhere": "所有位置",
"triggers.excluded": "在这些应用中不触发",
"triggers.excluded_hint": "进程名,用逗号分隔,例如 photoshop, code",
diff --git a/src/Filee.App/ViewModels/Pages/HomePageViewModel.cs b/src/Filee.App/ViewModels/Pages/HomePageViewModel.cs
index f85b8286..84e1e862 100644
--- a/src/Filee.App/ViewModels/Pages/HomePageViewModel.cs
+++ b/src/Filee.App/ViewModels/Pages/HomePageViewModel.cs
@@ -54,7 +54,7 @@ public sealed partial class HomePageViewModel : ObservableObject, IDisposable
_loc = loc;
_platform = platform;
var drag = store.Settings.Triggers.FirstOrDefault(t => t.Enabled && t.Kind == TriggerKind.Drag);
- DropHint = loc.Format("home.drop_hint", drag is null ? "—" : GestureText.Modifiers(drag.Modifiers));
+ DropHint = loc.Format(OperatingSystem.IsMacOS() ? "home.drop_hint_macos" : OperatingSystem.IsLinux() ? "home.drop_hint_linux" : "home.drop_hint", drag is null ? "—" : GestureText.Modifiers(drag.Modifiers));
store.HistoryChanged += OnHistoryChanged;
Reload();
}
diff --git a/src/Filee.App/ViewModels/Pages/TriggersPageViewModel.cs b/src/Filee.App/ViewModels/Pages/TriggersPageViewModel.cs
index 1d5d4598..5408ae9c 100644
--- a/src/Filee.App/ViewModels/Pages/TriggersPageViewModel.cs
+++ b/src/Filee.App/ViewModels/Pages/TriggersPageViewModel.cs
@@ -29,7 +29,11 @@ public sealed partial class TriggerGestureViewModel : ObservableObject
Kinds = Enum.GetValues<TriggerKind>().Select(k => new Choice<TriggerKind>(k, loc[$"triggers.kind.{k}"])).ToList();
Buttons = Enum.GetValues<TriggerMouseButton>().Where(b => b != TriggerMouseButton.None)
.Select(b => new Choice<TriggerMouseButton>(b, loc[$"triggers.button.{b}"])).ToList();
- Scopes = Enum.GetValues<TriggerScope>().Select(s => new Choice<TriggerScope>(s, loc[$"triggers.scope.{s}"])).ToList();
+ // The file manager has its own name on each system: Explorer, Finder, the Linux desktop's file manager.
+ var platform = OperatingSystem.IsMacOS() ? "_macos" : OperatingSystem.IsLinux() ? "_linux" : "";
+ Scopes = Enum.GetValues<TriggerScope>()
+ .Select(s => new Choice<TriggerScope>(s, loc[s == TriggerScope.FileManager ? $"triggers.scope.{s}{platform}" : $"triggers.scope.{s}"]))
+ .ToList();
RecordLabel = loc["triggers.record"];
RecordingLabel = loc["triggers.recording"];
SystemLabel = loc["triggers.threshold_system"];
diff --git a/tests/Filee.Engines.Tests/DocumentEngineTests.cs b/tests/Filee.Engines.Tests/DocumentEngineTests.cs
index ba730b34..61e20e2f 100644
--- a/tests/Filee.Engines.Tests/DocumentEngineTests.cs
+++ b/tests/Filee.Engines.Tests/DocumentEngineTests.cs
@@ -89,8 +89,7 @@ public class DocumentEngineTests(EngineFixture fx) : IClassFixture<EngineFixture
var back = await fx.ConvertAsync([hwp.Outputs.Single()], new Preset { TargetFormat = "hwpx" });
Assert.Equal(JobState.Completed, back.State);
Assert.Equal("rhwp", Assert.Single(fx.Catalog.CreatePlanner().Plan("hwp", "hwpx")!.Steps).Converter.Id);
- using var document = Unhwp.UnhwpDocument.ParseFile(back.Outputs.Single());
- Assert.Contains("두 번째 문단입니다", document.ToText());
+ Assert.Contains("두 번째 문단입니다", HwpxAssert.ReadBackText(back.Outputs.Single()));
}
[Fact]
diff --git a/tests/Filee.Engines.Tests/HtmlReaderTests.cs b/tests/Filee.Engines.Tests/HtmlReaderTests.cs
index a570698c..1c555762 100644
--- a/tests/Filee.Engines.Tests/HtmlReaderTests.cs
+++ b/tests/Filee.Engines.Tests/HtmlReaderTests.cs
@@ -280,9 +280,8 @@ public class HtmlReaderTests(EngineFixture fx) : IClassFixture<EngineFixture>
Assert.True(job.State == JobState.Completed, string.Join("; ", job.Files.Select(f => $"{f.ErrorKey} {f.ErrorDetail}")));
var hwpx = job.Outputs.Single();
ValidPackage(hwpx, expectImages: 1);
- using (var document = Unhwp.UnhwpDocument.ParseFile(hwpx))
{
- var text = document.ToText();
+ var text = HwpxAssert.ReadBackText(hwpx);
foreach (var expected in new[] { "분기 보고서", "12%", "서울", "부산", "매출", "둘째 쪽" })
Assert.Contains(expected, text);
}
diff --git a/tests/Filee.Engines.Tests/HwpxAssert.cs b/tests/Filee.Engines.Tests/HwpxAssert.cs
index e1927fa0..211917a1 100644
--- a/tests/Filee.Engines.Tests/HwpxAssert.cs
+++ b/tests/Filee.Engines.Tests/HwpxAssert.cs
@@ -86,6 +86,23 @@ internal static class HwpxAssert
return XDocument.Load(zip.GetEntry(entry)!.Open(), LoadOptions.PreserveWhitespace).Root!;
}
+ /// <summary>
+ /// The text of an HWPX as an independent reader sees it: Unhwp where its native library exists, else (Linux ARM64)
+ /// the text of the section XML.
+ /// </summary>
+ public static string ReadBackText(string hwpx)
+ {
+ if (new Filee.Engines.Hwp.UnhwpConverter().GetStatus().IsAvailable)
+ {
+ using var document = Unhwp.UnhwpDocument.ParseFile(hwpx);
+ return document.ToText();
+ }
+ using var zip = ZipFile.OpenRead(hwpx);
+ return string.Join("\n", zip.Entries.Where(e => e.FullName.StartsWith("Contents/section", StringComparison.Ordinal))
+ .OrderBy(e => e.FullName, StringComparer.Ordinal)
+ .Select(e => XDocument.Load(e.Open()).Root!.Value));
+ }
+
/// <summary>The header element with the given id.</summary>
public static XElement HeadItem(string hwpx, string name, string id) =>
Xml(hwpx, "Contents/header.xml").Descendants(Hh + name).Single(e => (string?)e.Attribute("id") == id);
diff --git a/tests/Filee.Engines.Tests/HwpxWriterTests.cs b/tests/Filee.Engines.Tests/HwpxWriterTests.cs
index 5d80d46c..99cd3504 100644
--- a/tests/Filee.Engines.Tests/HwpxWriterTests.cs
+++ b/tests/Filee.Engines.Tests/HwpxWriterTests.cs
@@ -70,8 +70,7 @@ public class HwpxWriterTests(EngineFixture fx) : IClassFixture<EngineFixture>
var hwpx = await ConvertAsync(md);
ValidPackage(hwpx, expectImages: 1);
- using var document = UnhwpDocument.ParseFile(hwpx);
- var text = document.ToText();
+ var text = HwpxAssert.ReadBackText(hwpx);
foreach (var expected in new[] { "첫 번째 제목", "굵게", "취소선", "인용문도 사라지면 안 됩니다", "셋째부터 시작", "중첩 글머리", "표 셀", "42", "코드 블록" })
Assert.Contains(expected, text);
@@ -122,8 +121,7 @@ public class HwpxWriterTests(EngineFixture fx) : IClassFixture<EngineFixture>
var hwpx = await ConvertAsync(txt);
ValidPackage(hwpx, expectImages: 0);
- using var document = UnhwpDocument.ParseFile(hwpx);
- Assert.Contains("세 번째 줄 <태그> & 기호", document.ToText());
+ Assert.Contains("세 번째 줄 <태그> & 기호", HwpxAssert.ReadBackText(hwpx));
}
[Fact]
diff --git a/tests/Filee.Engines.Tests/MarkdownTests.cs b/tests/Filee.Engines.Tests/MarkdownTests.cs
index bacaea10..aab80f76 100644
--- a/tests/Filee.Engines.Tests/MarkdownTests.cs
+++ b/tests/Filee.Engines.Tests/MarkdownTests.cs
@@ -112,8 +112,7 @@ public class MarkdownTests(EngineFixture fx) : IClassFixture<EngineFixture>
var hwpx = await ConvertAsync(await WriteSampleAsync(dir), "hwpx");
HwpxAssert.ValidPackage(hwpx, expectImages: 1);
- using var document = Unhwp.UnhwpDocument.ParseFile(hwpx);
- var text = document.ToText();
+ var text = HwpxAssert.ReadBackText(hwpx);
foreach (var expected in new[] { "주간 회의", "배포", "v1.0.1", "설치", "민지", "☑ 끝낸 일", "☐ 남은 일" })
Assert.Contains(expected, text);
Assert.DoesNotContain("title:", text);