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.

Keep the original file dates for every conversion, from Settings > General

KnifeLemon8638e8394d68
diff --git a/src/Filee.App/Assets/i18n/en.json b/src/Filee.App/Assets/i18n/en.json
index 227da8f8..1cead98b 100644
--- a/src/Filee.App/Assets/i18n/en.json
+++ b/src/Filee.App/Assets/i18n/en.json
@@ -136,6 +136,8 @@
"general.modern_menu_remove_failed": "Windows did not remove the entry: {0}",
"general.default_output": "Default save location",
"general.default_output_hint": "Presets set to “Default save location” save here. A preset with its own location keeps it.",
+ "general.keep_dates": "Keep the original file dates for every conversion",
+ "general.keep_dates_hint": "Converted files get the created and modified dates of the original, with every preset. Off: only presets with \"Keep the original file dates\" do it.",
"general.check_updates": "Check for updates automatically",
"general.history": "Conversion history",
"general.no_history": "Don't keep a history of recent conversions",
diff --git a/src/Filee.App/Assets/i18n/ko.json b/src/Filee.App/Assets/i18n/ko.json
index 57757dbd..e1cdce4f 100644
--- a/src/Filee.App/Assets/i18n/ko.json
+++ b/src/Filee.App/Assets/i18n/ko.json
@@ -136,6 +136,8 @@
"general.modern_menu_remove_failed": "Windows가 항목을 제거하지 못했어요: {0}",
"general.default_output": "기본 저장 위치",
"general.default_output_hint": "저장 위치가 “기본 저장 위치”인 프리셋은 여기에 저장해요. 저장 위치를 따로 정한 프리셋은 그대로예요.",
+ "general.keep_dates": "모든 변환에서 원본 파일 날짜 유지",
+ "general.keep_dates_hint": "어떤 프리셋으로 변환하든 원본의 만든 날짜와 수정한 날짜를 그대로 넣어요. 끄면 \"원본 파일 날짜 유지\"를 켠 프리셋만 그렇게 해요.",
"general.check_updates": "자동으로 업데이트 확인",
"general.history": "변환 기록",
"general.no_history": "최근 변환 기록 남기지 않기",
diff --git a/src/Filee.App/Assets/i18n/zh-CN.json b/src/Filee.App/Assets/i18n/zh-CN.json
index 422750d8..0d576873 100644
--- a/src/Filee.App/Assets/i18n/zh-CN.json
+++ b/src/Filee.App/Assets/i18n/zh-CN.json
@@ -136,6 +136,8 @@
"general.modern_menu_remove_failed": "Windows 未能移除此项:{0}",
"general.default_output": "默认保存位置",
"general.default_output_hint": "保存位置为“默认保存位置”的预设会保存到这里。单独设置了保存位置的预设不受影响。",
+ "general.keep_dates": "所有转换都保留原文件日期",
+ "general.keep_dates_hint": "无论使用哪个预设,转换后的文件都沿用原文件的创建和修改日期。关闭时,只有勾选了“保留原文件日期”的预设会这样做。",
"general.check_updates": "自动检查更新",
"general.history": "转换记录",
"general.no_history": "不保留最近的转换记录",
diff --git a/src/Filee.App/ViewModels/Pages/GeneralPageViewModel.cs b/src/Filee.App/ViewModels/Pages/GeneralPageViewModel.cs
index 86092656..10a720bf 100644
--- a/src/Filee.App/ViewModels/Pages/GeneralPageViewModel.cs
+++ b/src/Filee.App/ViewModels/Pages/GeneralPageViewModel.cs
@@ -40,6 +40,7 @@ public sealed partial class GeneralPageViewModel : ObservableObject, IDisposable
_defaultLocation = OutputLocations.FirstOrDefault(l => l.Value == output.Location) ?? OutputLocations[0];
_defaultSubfolder = output.SubfolderName;
_defaultFolder = output.CustomFolder;
+ _keepFileDates = store.Settings.KeepFileDates;
_historyCount = store.History.Count;
ShowUpdateState(updates.LatestVersion);
updates.PropertyChanged += OnUpdatesChanged;
@@ -81,6 +82,10 @@ public sealed partial class GeneralPageViewModel : ObservableObject, IDisposable
partial void OnDefaultFolderChanged(string value) => Save(s => s.DefaultOutput.CustomFolder = value.Trim());
+ [ObservableProperty] private bool _keepFileDates;
+
+ partial void OnKeepFileDatesChanged(bool value) => Save(s => s.KeepFileDates = value);
+
[ObservableProperty] private Choice<string> _language;
[ObservableProperty] private bool _startWithSystem;
[ObservableProperty] private bool _contextMenu;
diff --git a/src/Filee.App/Views/Pages/GeneralPage.axaml b/src/Filee.App/Views/Pages/GeneralPage.axaml
index 806fe7a6..737dfa4b 100644
--- a/src/Filee.App/Views/Pages/GeneralPage.axaml
+++ b/src/Filee.App/Views/Pages/GeneralPage.axaml
@@ -42,6 +42,8 @@
<TextBox Text="{Binding DefaultFolder}" />
</DockPanel>
</StackPanel>
+ <ToggleSwitch Content="{DynamicResource general.keep_dates}" IsChecked="{Binding KeepFileDates}" />
+ <TextBlock Classes="caption" TextWrapping="Wrap" Text="{DynamicResource general.keep_dates_hint}" Margin="0,-6,0,0" />
</StackPanel>
</Border>
diff --git a/src/Filee.Cli/Cli.cs b/src/Filee.Cli/Cli.cs
index 63ea707b..58543c97 100644
--- a/src/Filee.Cli/Cli.cs
+++ b/src/Filee.Cli/Cli.cs
@@ -231,6 +231,7 @@ internal static class Cli
}
preset = found.Clone();
}
+ preset = host.Store.Settings.WithDefaultOutput(preset);
if (options.Quality is { } quality)
preset.Image.Quality = quality;
if (options.Conflict is { } conflict)
diff --git a/src/Filee.Core/Settings/AppSettings.cs b/src/Filee.Core/Settings/AppSettings.cs
index 37b2d6fa..e6bf04aa 100644
--- a/src/Filee.Core/Settings/AppSettings.cs
+++ b/src/Filee.Core/Settings/AppSettings.cs
@@ -105,18 +105,29 @@ public sealed class AppSettings
/// <summary>Where presets set to "Default" save (Settings → General).</summary>
public DefaultOutputSettings DefaultOutput { get; set; } = new();
+ /// <summary>Every conversion keeps the created and modified dates of the original, whatever the preset says.</summary>
+ public bool KeepFileDates { get; set; }
+
/// <summary>
- /// Returns <paramref name="preset"/> itself, or a copy that saves to <see cref="DefaultOutput"/> when the preset's
- /// location is <see cref="OutputLocation.Default"/>. Name pattern, conflict handling and dates stay the preset's.
+ /// Returns <paramref name="preset"/> itself, or a copy with the app-wide output settings applied: it saves to
+ /// <see cref="DefaultOutput"/> when the preset's location is <see cref="OutputLocation.Default"/>, and keeps the
+ /// original dates when <see cref="KeepFileDates"/> is on. Name pattern and conflict handling stay the preset's.
/// </summary>
public Preset WithDefaultOutput(Preset preset)
{
- if (preset.Output.Location != OutputLocation.Default)
+ var location = preset.Output.Location == OutputLocation.Default;
+ var dates = KeepFileDates && !preset.Output.KeepDates;
+ if (!location && !dates)
return preset;
var copy = preset.Clone();
- copy.Output.Location = DefaultOutput.Location == OutputLocation.Default ? OutputLocation.SameFolder : DefaultOutput.Location;
- copy.Output.SubfolderName = DefaultOutput.SubfolderName;
- copy.Output.CustomFolder = DefaultOutput.CustomFolder;
+ if (location)
+ {
+ copy.Output.Location = DefaultOutput.Location == OutputLocation.Default ? OutputLocation.SameFolder : DefaultOutput.Location;
+ copy.Output.SubfolderName = DefaultOutput.SubfolderName;
+ copy.Output.CustomFolder = DefaultOutput.CustomFolder;
+ }
+ if (dates)
+ copy.Output.KeepDates = true;
return copy;
}
}
diff --git a/tests/Filee.Core.Tests/DefaultOutputTests.cs b/tests/Filee.Core.Tests/DefaultOutputTests.cs
index a78207e9..b0f9268e 100644
--- a/tests/Filee.Core.Tests/DefaultOutputTests.cs
+++ b/tests/Filee.Core.Tests/DefaultOutputTests.cs
@@ -59,6 +59,19 @@ public class DefaultOutputTests
Assert.Equal("out", used.Output.SubfolderName);
}
+ [Fact]
+ public void Keep_file_dates_turns_dates_on_for_every_preset()
+ {
+ var settings = new AppSettings { KeepFileDates = true };
+ var own = new Preset { Output = { Location = OutputLocation.SameFolder } };
+
+ var applied = settings.WithDefaultOutput(own);
+
+ Assert.True(applied.Output.KeepDates);
+ Assert.False(own.Output.KeepDates); // a copy: the saved preset is unchanged
+ Assert.Same(own, new AppSettings().WithDefaultOutput(own));
+ }
+
[Fact]
public void Presets_with_their_own_location_ignore_the_default()
{