Repository navigation
feat(presets): save to Ask every time (#521) - #572
cre8ive-marketing wants to merge 4 commits into
Conversation
A preset can ask where to save: a save dialog that starts in the source's folder, once per batch. One result (a single file, or a merge) is saved under the name chosen; several go into the chosen folder under their own names. Watch folders and the command line can't ask: they save next to the source. Files from a browser keep saving into the download folder.
KnifeLemon
left a comment
There was a problem hiding this comment.
Thanks @cre8ive-marketing, this follows what we agreed in #521: the dialog starts in the source's folder, a batch asks once, Cancel starts nothing, and the library preset stays untouched (the answered copy is what runs, so a retry keeps the chosen place). Keeping the decision logic in AskedLocation with tests is good, and nothing outside the donut can wait on a dialog: the CLI resolves Ask next to the source, and watch folders always write into their own output folder (WatchRule.Apply sets the location), so neither can hang.
A few things to fix:
-
Overwritereaches files the dialog never asked about:src/Filee.Core/Presets/AskedLocation.cs:39. The whole job runs withConflictPolicy.Overwrite, but the dialog confirmed one exact path:- one source that becomes several files (a PDF split into pages, PDF → JPG per page, frames, Extract):
holiday_p1.jpg,holiday_p2.jpg, … silently replace existing files; - a typed extension other than the target's (
holiday.jpegorholiday.pngwith a JPG preset): the result isholiday.jpg, not the confirmed name, and an existingholiday.jpgis replaced without asking; - "Save as ZIP" (or Settings › General's ZIP for geo results): the dialog suggests
.jpg(Extension, line 24) but the result isholiday.zip, replaced silently.
I confirmed all three with
OutputPathResolver.Resolveon the asked rule. Suggested fix: keep the preset's ownConflictand let only the exact confirmed path be replaced (e.g. a runtime-only[JsonIgnore]path onOutputRulethatResolvetreats as free); ask withstore.Settings.WithDefaultOutput(preset)and returnzipfromExtensionwhen the result is zipped. A JobQueue test with an existingname_p1/name.zipwould cover it. - one source that becomes several files (a PDF split into pages, PDF → JPG per page, frames, Extract):
-
An older Filee resets every preset when it reads
"location": "Ask":src/Filee.Core/Presets/OutputRule.cs:40.Locationgoes through the context-wideUseStringEnumConverter(FileeJsonContext), notLenientEnumJsonConverter, so 2.1.0 throwsJsonExceptionon the unknown name;UserDataStore.Readthen treatspresets.jsonas broken, loads the factory presets, and the next save overwrites the user's. The same applies tohistory.json(aHistoryEntrykeeps its preset, and runs that didn't ask, such as the CLI or browser drops, storeAsk) and to an exported bundle imported into 2.1.0. So "an older Filee falls back to its default location" in the description doesn't hold. Fix: leaveLocationas it is and keep the choice in a separate bool (e.g.AskEveryTime: older versions skip unknown properties and useLocation), and put[JsonConverter(typeof(LenientEnumJsonConverter<OutputLocation>))]onLocationfor future values. No schema bump is needed (a missing bool reads as false); please don't take 47, other open PRs already use it. -
Several sources, one result, but the folder dialog:
src/Filee.App/Services/RadialController.cs:354.oneResult: sources.Count == 1sends "Combine into one archive" (PacksIntoOneArchive) and multi-page TIFF to the folder picker, though they make one file (JobQueue uses its one-file allocator for both). Treat those as one result too, as the description says. -
"Replace the original" throws the chosen place away:
src/Filee.Core/Presets/AskedLocation.cs:46(InFolder). WithReplaceOriginalon (a same-format preset such as compress),JobQueue.ReplaceOriginalmoves the result back over the source after the user picked where to save. Setcopy.Output.ReplaceOriginal = falsethere, asWatchRule.Applydoes.
One question: did you try it on macOS? The dialog's owner is a 1×1 transparent, undecorated window; if the save panel attaches to it as a sheet, it may show in an odd place or behind other apps.
German (#541) was merged after this PR was opened, so de.json is missing the three new keys; we'll add those on our side. Once the four points are in and CI is green, this is good to merge.
…ne-file batches From the review of KnifeLemon#572: - The job keeps the preset's own conflict policy; only the exact path the save dialog confirmed may replace a file (OutputRule.ConfirmedPath, runtime only). Pages, a typed extension other than the result's, and ZIPs get numbered as usual. The dialog is asked with Settings › General applied, and suggests .zip for a ZIP. - "Ask every time" is OutputRule.AskEveryTime, not a Location value, so an older Filee keeps the preset and uses its Location. Location reads an unknown name as Default (LenientEnumJsonConverter). - Several sources that make one file (merged PDF, multi-page TIFF, one archive, joins) are asked for by name (AskedLocation.MakesOneResult). - The chosen place turns "Replace the original" off for that run.
|
@KnifeLemon, thanks for checking each case with
macOS: no, I haven't tried it there; we don't have a Mac. If the panel attaches to the 1×1 host as a sheet, it could show in an odd place. An option is to use the main window as the owner when it's visible, and the host only when Filee is in the tray. Could someone with a Mac (for example the contributor from #551) give it a quick try? I added the three German strings already (7e3d2a1), so there's nothing left to add on your side. Full |
Closes #521, as approved there: the dialog starts in the source's folder and asks once per batch.
What it does
Settings → Presets → Save to → Ask every time (a new
OutputLocation.Ask). Converting with such a preset from the donut first asks where to save:The default stays as it is; only presets set to this option ask. No settings or schema change: an older Filee reading the preset falls back to its default location. Strings (
presets.location.Ask,ask.save_title,ask.folder_title) are in all 16 languages.Tests
AskedLocationTests(Core):LocalizationTestsand the preset editor tests pass with the new choice in the list.AskedLocation.dotnet format --verify-no-changesis clean.dotnet test: Platform 81, Core 606, CLI 27, Setup 176, Engines 1821 and App 1344 pass, none fail.