mirror of
https://github.com/cookiengineer/audacity
synced 2025-04-30 15:49:41 +02:00
37 lines
1.1 KiB
Diff
37 lines
1.1 KiB
Diff
--- orig/wxWidgets-3.0.2/src/common/filefn.cpp 2014-10-06 16:33:44.000000000 -0500
|
|
+++ wxWidgets-3.0.2/src/common/filefn.cpp 2015-12-21 16:54:57.998187800 -0600
|
|
@@ -1161,7 +1161,8 @@
|
|
bool
|
|
wxRenameFile(const wxString& file1, const wxString& file2, bool overwrite)
|
|
{
|
|
- if ( !overwrite && wxFileExists(file2) )
|
|
+ bool exists = wxFileExists(file2);
|
|
+ if ( !overwrite && exists )
|
|
{
|
|
wxLogSysError
|
|
(
|
|
@@ -1174,8 +1175,21 @@
|
|
|
|
#if !defined(__WXWINCE__)
|
|
// Normal system call
|
|
- if ( wxRename (file1, file2) == 0 )
|
|
- return true;
|
|
+ //
|
|
+ // For explanation, see: (warning...based mostly on observed behavior)
|
|
+ // http://bugzilla.audacityteam.org/show_bug.cgi?id=1266
|
|
+ // https://github.com/audacity/audacity/pull/94
|
|
+ unsigned long doserrno = 0;
|
|
+ for (int i = 0; i < 2000; i++)
|
|
+ {
|
|
+ if ( wxRename (file1, file2) == 0 )
|
|
+ return true;
|
|
+ unsigned long doserrno;
|
|
+ _get_doserrno(&doserrno);
|
|
+ if (doserrno != ERROR_ACCESS_DENIED && (doserrno != ERROR_ALREADY_EXISTS || exists))
|
|
+ break;
|
|
+ wxMilliSleep(1);
|
|
+ }
|
|
#endif
|
|
|
|
// Try to copy
|