aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Dobbelaere2018-03-30 18:13:19 +0200
committerHein-Pieter van Braam2018-04-28 20:06:30 +0200
commit060f9f2cd70354897e45bab5f95c48a9d62404f4 (patch)
tree6b7315a70ff0c8fb84aa0b80e1aa4af4f8009f76
parent4c19fc2eb10e9b9773f0a67938a8210d4ea30e9b (diff)
downloadgodot-060f9f2cd70354897e45bab5f95c48a9d62404f4.tar.gz
godot-060f9f2cd70354897e45bab5f95c48a9d62404f4.tar.zst
godot-060f9f2cd70354897e45bab5f95c48a9d62404f4.zip
Trigger IO error only after exhausting attempts
(cherry picked from commit a4fae0e5e3dd33b87aae71151e28a3c832a6fa67)
-rw-r--r--drivers/windows/file_access_windows.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp
index 6f46bea18..a07be5c4f 100644
--- a/drivers/windows/file_access_windows.cpp
+++ b/drivers/windows/file_access_windows.cpp
@@ -138,16 +138,22 @@ void FileAccessWindows::close() {
//atomic replace for existing file
rename_error = !ReplaceFileW(save_path.c_str(), (save_path + ".tmp").c_str(), NULL, 2 | 4, NULL, NULL);
}
- if (rename_error && close_fail_notify) {
- close_fail_notify(save_path);
- }
if (rename_error) {
attempts--;
OS::get_singleton()->delay_usec(1000000); //wait 100msec and try again
}
}
+ if (rename_error) {
+ if (close_fail_notify) {
+ close_fail_notify(save_path);
+ }
+
+ ERR_EXPLAIN("Safe save failed. This may be a permissions problem, but also may happen because you are running a paranoid antivirus. If this is the case, please switch to Windows Defender or disable the 'safe save' option in editor settings. This makes it work, but increases the risk of file corruption in a crash.");
+ }
+
save_path = "";
+
ERR_FAIL_COND(rename_error);
}
}