Skip to content

Fix #58: add autosave backup rotation and atomic write#59

Open
Nico-du-34 wants to merge 1 commit intogrzybeek:masterfrom
Nico-du-34:feat/autosave-backup-atomic-write
Open

Fix #58: add autosave backup rotation and atomic write#59
Nico-du-34 wants to merge 1 commit intogrzybeek:masterfrom
Nico-du-34:feat/autosave-backup-atomic-write

Conversation

@Nico-du-34
Copy link
Copy Markdown

Summary

This PR improves autosave reliability by adding backup rotation and atomic file writes.

Closes #58.

Changes

  • Replace direct autosave writes with a safer flow:
    • Write JSON to a temporary file in the same directory
    • Rename existing autosave file to autosave.json.bak
    • Atomically move the temp file to autosave.json
  • Add failure handling:
    • Clean up temporary files on error
    • Attempt to restore previous autosave from .bak if rotation happened but final replace failed
  • Keep errors non-crashing through existing save-level exception handling and logging

Validation

  • dotnet build grzyClothTool/grzyClothTool.csproj -v minimal
  • Result: 0 errors

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.

[SUGGESTION] Improve autosave system with backup (.bak) support

1 participant