Skip to content

Autosave falls back to a per-user folder when the project's folder can't be written (#37) - #226

Merged
kjmikkel merged 1 commit into
mainfrom
feat/37-autosave-fallback
Oct 16, 2026
Merged

kjmikkel merged 1 commit into
mainfrom
feat/37-autosave-fallback

Conversation

@kjmikkel

Copy link
Copy Markdown
Owner

Closes #37.

Change

  • AutosaveRecovery:
    • Fallback location: %LOCALAPPDATA%\PillarsDialogEditor\autosave\<file name>.<16-hex hash of the full path>.autosave, plus generations. The hash ignores path casing, and two projects with the same file name don't collide.
    • IsLocationFailure decides when to fall back: UnauthorizedAccessException, DirectoryNotFoundException, or a write-protected volume (0x80070013). A sharing violation doesn't count, since that's a passing moment rather than the location.
    • Check looks next to the project and in the fallback folder, and returns the newer copy (IsFallback says which).
    • TryDelete sweeps every generation in both places, so central copies don't pile up.
  • MainWindowViewModel.AutosaveTick:
    • Tries next to the project first, every tick, so a folder that becomes writable again is used again.
    • On a location failure it writes the fallback copy instead.
    • It says so once per project in the status bar, without a dialog.
  • Restore offer: the seam now passes the fallback folder (null for a copy next to the project), and the dialog adds a sentence saying the copy was kept in the editor's own folder.
  • Strings: Status_AutosaveFallback and AutosaveRestore_FromFallback, in Strings.axaml.

Tests

  • AutosaveFallbackTests (16 cases): the path, keying, casing, generations, Check choosing the newer copy, a stale fallback copy, deletion sweeping both places, rotation, and the exception classification.
  • MainWindowViewModelAutosaveTests:
    • an unwritable project folder writes the fallback copy, and the status is shown once, not on every tick;
    • a newer fallback copy is offered with its folder and restored;
    • a local copy is offered without a folder.
  • The unwritable folder is simulated by a directory sitting where the sidecar file should go, which gives UnauthorizedAccessException; the serializer creates missing folders, so a missing folder doesn't work. With the fallback disabled, both tick tests fail.
  • Full headless suite: 4165 passed, 0 failed, 17 skipped.

🤖 Generated with Claude Code

…der can't be written (#37)

On a location failure (no access, missing folder, write-protected volume)
the autosave tick writes its recovery copy, with generations, to
%LOCALAPPDATA%\PillarsDialogEditor\autosave, keyed by a hash of the full
project path, and says so once in the status bar. Check consults both
places and offers the newer copy; the restore dialog says where a fallback
copy came from; save and discard sweep both places.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kjmikkel
kjmikkel merged commit 623a245 into main Oct 16, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Autosave: fall back to a central location when the project's folder is not writable

1 participant