Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not depend on FileExists() when opening save files for writing #7696

Merged
merged 1 commit into from
Feb 2, 2025

Conversation

StephenCWills
Copy link
Member

@StephenCWills StephenCWills commented Feb 2, 2025

Because the ab file mode doesn't outright fail when the save file already exists, it turns out a false negative result from FileExists() can still wipe out a save file. The good news is that GetFileSize() can't retrieve a valid value for size_ if an error occurs. Since we are querying the file size anyway, we can rely on that result to determine whether the MPQ we opened is a newly created file.

@AJenbo AJenbo merged commit d9dc491 into diasurgical:master Feb 2, 2025
23 checks passed
@StephenCWills StephenCWills deleted the fix-save-wipe branch February 2, 2025 04:40
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.

2 participants