Skip to content

fix: recover storage after an interrupted file replace - #96

Merged
imurashka merged 2 commits into
mainfrom
ivan/recover-interrupted-replace
Oct 6, 2026
Merged

imurashka merged 2 commits into
mainfrom
ivan/recover-interrupted-replace

Conversation

@imurashka

Copy link
Copy Markdown
Contributor

On Windows, File.Replace moves the main file to the backup and then the temp file to the main one. A save stopped between the two left the temp file and the backup with no main file, and the next load started empty. The load now takes the temp file as the main file in that case, and falls back to the backup if it cannot be read.

The backup is now deleted first when an emptied storage removes its files, and a broken main file is replaced by the backup in one step, so a backup alone on disk is never left by the package itself.

@imurashka
imurashka merged commit 8d966b8 into main Oct 6, 2026
2 checks passed
@imurashka
imurashka deleted the ivan/recover-interrupted-replace branch October 6, 2026 11:04
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.

1 participant