From e254a8a0017bc0af5bc7e1a4c780a90a7b081be5 Mon Sep 17 00:00:00 2001 From: KnifeLemon Date: Tue, 17 Nov 2026 21:36:18 +0900 Subject: [PATCH] fix(formats): read CrossOver logs (.cxlog) as text A CrossOver .cxlog is a plain-text log, so the TXT format now takes it next to .log: it converts to PDF, DOCX, HTML, Markdown and the other text targets. Settings schema 96 teaches existing text donuts the extension unless a donut of the user already claims it. Fixes #1383 Co-Authored-By: Claude Opus 5.5 --- docs/ENGINES.md | 2 +- src/Filee.Core/Formats/FormatRegistry.cs | 8 +++---- src/Filee.Core/Settings/AppSettings.cs | 2 +- src/Filee.Core/Settings/UserDataStore.cs | 4 ++++ tests/Filee.Core.Tests/ScriptTextTests.cs | 27 ++++++++++++++++++++++- 5 files changed, 36 insertions(+), 7 deletions(-) diff --git a/docs/ENGINES.md b/docs/ENGINES.md index 3fcf25195..ec91e4615 100644 --- a/docs/ENGINES.md +++ b/docs/ENGINES.md @@ -12,7 +12,7 @@ Filee chooses engines automatically. Settings → *Engines* shows their status, | PDFsharp | built in (library) | images → PDF (CMYK pictures stay CMYK), merge, split, page ranges, page organising, lossless rotate and crop-box edits, pages per sheet (N-up), spreadsheet print-studio assembly, **compression** (smaller PDFs, see below), PDFs without their metadata | | PDFium | built in (library) | PDF → images (multi-page TIFF/GIF supported); CMYK pages → CMYK JPG/TIFF through Ghostscript when it is installed | | Unhwp | built in (library) | HWP/HWPX → TXT, Markdown, HTML (pictures in a `_files` folder next to the Markdown, embedded in the HTML) | -| Text & Markdown (Markdig) | built in (library) | **Markdown → HTML, TXT**; **TXT, LOG, PY, PAC, BAT, CMD, COMMAND, LUA, CSS, PS1, SQL, AHK, INI, RSC, C, H, CPP, CC, CXX, HPP, HH, HXX, CS, DART, HQL, DBML, JAVA, INO, PDE → UTF-8 TXT**, preserving source text without running scripts (and → PDF / DOCX through the HWPX writer, rhwp or LibreOffice) | +| Text & Markdown (Markdig) | built in (library) | **Markdown → HTML, TXT**; **TXT, LOG, CXLOG, PY, PAC, BAT, CMD, COMMAND, LUA, CSS, PS1, SQL, AHK, INI, RSC, C, H, CPP, CC, CXX, HPP, HH, HXX, CS, DART, HQL, DBML, JAVA, INO, PDE → UTF-8 TXT**, preserving source text without running scripts (and → PDF / DOCX through the HWPX writer, rhwp or LibreOffice) | | Spreadsheets (ExcelDataReader for XLS) | built in (library) | **XLSX, XLS, ODS, CSV, TSV → XLSX, ODS, CSV, TSV** (one CSV / TSV per sheet) | | Office Open XML | built in | **DOCM / DOTX / DOTM ↔ DOCX, XLSM / XLTX ↔ XLSX, PPTM / POTX / POTM / PPSX ↔ PPTX** (macros removed for macro-free types) | | Fonts | built in | **TTF, OTF, WOFF, WOFF2, EOT ↔ each other**; **FON (NE monochrome FNT v2/v3, supported single-byte charsets) → TTF, OTF, WOFF, WOFF2, EOT only**; CFF (PostScript) outlines become TrueType for TTF and EOT | diff --git a/src/Filee.Core/Formats/FormatRegistry.cs b/src/Filee.Core/Formats/FormatRegistry.cs index 544666022..38205fafc 100644 --- a/src/Filee.Core/Formats/FormatRegistry.cs +++ b/src/Filee.Core/Formats/FormatRegistry.cs @@ -166,11 +166,11 @@ public static class FormatRegistry new("sda", "SDA", FormatCategory.Presentation, ["sda", "sdd"], Writable: false), // Plain text / markup - // Text logs, source code (Arduino and Processing sketches too), database schemas (DBML), proxy scripts, style sheets and settings files are read as plain - // text, never executed, compiled or translated (issues #273, #284, #254, #388, #368, #607, #536, #630, #661, #660, - // #864, #828, #980, #997, #854, #1176). + // Text logs (CrossOver's .cxlog too), source code (Arduino and Processing sketches too), database schemas (DBML), proxy + // scripts, style sheets and settings files are read as plain text, never executed, compiled or translated (issues + // #273, #284, #254, #388, #368, #607, #536, #630, #661, #660, #864, #828, #980, #997, #854, #1176, #1383). new("txt", "TXT", FormatCategory.Text, - ["txt", "log", "py", "pac", "bat", "cmd", "command", "lua", "css", "ps1", "sql", "ahk", "ini", "rsc", + ["txt", "log", "cxlog", "py", "pac", "bat", "cmd", "command", "lua", "css", "ps1", "sql", "ahk", "ini", "rsc", "c", "h", "cpp", "cc", "cxx", "hpp", "hh", "hxx", "cs", "dart", "hql", "dbml", "java", "ino", "pde"]), new("md", "Markdown", FormatCategory.Text, ["md", "markdown"]), new("html", "HTML", FormatCategory.Text, ["html", "htm", "xhtml"]), diff --git a/src/Filee.Core/Settings/AppSettings.cs b/src/Filee.Core/Settings/AppSettings.cs index 34a0e680f..1ff5c1316 100644 --- a/src/Filee.Core/Settings/AppSettings.cs +++ b/src/Filee.Core/Settings/AppSettings.cs @@ -170,7 +170,7 @@ public static bool IsFlipKeyAllowed(string key, IEnumerable gest public sealed class AppSettings { /// Current schema version. Increase when the format changes and add a migration. - public const int CurrentSchemaVersion = 95; + public const int CurrentSchemaVersion = 96; public int SchemaVersion { get; set; } = CurrentSchemaVersion; diff --git a/src/Filee.Core/Settings/UserDataStore.cs b/src/Filee.Core/Settings/UserDataStore.cs index 3150a8888..96e2f6baf 100644 --- a/src/Filee.Core/Settings/UserDataStore.cs +++ b/src/Filee.Core/Settings/UserDataStore.cs @@ -1179,6 +1179,10 @@ public static bool ApplyToLibrary(int from, List presets, List Assert.Equal("txt", FormatRegistry.Detect(name)?.Id); [Fact] @@ -189,4 +192,26 @@ public void Version_86_text_donuts_learn_ino_and_pde_without_taking_custom_claim Assert.False(SettingsMigrations.ApplyToLibrary(86, presets, profiles)); Assert.DoesNotContain("ino", text); // the user's own donut has it } + + [Fact] + public void A_crossover_log_uses_the_text_donut() => + Assert.Equal("text", ProfileSelector.Select(BuiltInData.CreateProfiles(), ["Steam.cxlog"])?.Id); + + [Fact] + public void Version_95_text_donuts_learn_cxlog_without_taking_custom_claims() + { + var presets = BuiltInData.CreatePresets(); + var profiles = BuiltInData.CreateProfiles(); + var text = profiles.Single(p => p.Id == "text").Extensions; + text.Remove("cxlog"); + + Assert.True(SettingsMigrations.ApplyToLibrary(95, presets, profiles)); + Assert.Contains("cxlog", text); + Assert.False(SettingsMigrations.ApplyToLibrary(95, presets, profiles)); + + text.Remove("cxlog"); + profiles.Insert(0, new ToolbarProfile { Id = "my-logs", Name = "Logs", Extensions = ["CXLOG"] }); + Assert.False(SettingsMigrations.ApplyToLibrary(95, presets, profiles)); + Assert.DoesNotContain("cxlog", text); // the user's own donut has it + } }