diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-04-03 13:21:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-03 13:21:53 +0200 |
commit | 9ad180029876a53747df577d8925a055f6b9687e (patch) | |
tree | 60841a08d8f8473b0b64e09c87061bb37c76bea0 /drivers | |
parent | fa9104204f4a72b432c2bff7179478cbb487e597 (diff) | |
parent | a4fae0e5e3dd33b87aae71151e28a3c832a6fa67 (diff) |
Merge pull request #17869 from TomDobbelaere/rename-error-usability
Trigger rename_error's close_fail_notify only after exhausting attempts on Windows
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/windows/file_access_windows.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp index e10f4d05e8..23c8ea2ec7 100644 --- a/drivers/windows/file_access_windows.cpp +++ b/drivers/windows/file_access_windows.cpp @@ -139,19 +139,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 } } - save_path = ""; 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); } } |