Don't rename existing schematic file
We should never leave a situation where the schematic file may no longer exist (if the first rename succeeds and the second fails). So, make a backup copy of the original schematic file and then attempt to rename the autosave over the first file. In this case, if either attempt fails, we do not lose the original file Fixes https://gitlab.com/kicad/code/kicad/issues/10074 Fixes https://gitlab.com/kicad/code/kicad/issues/10256 Fixes https://gitlab.com/kicad/code/kicad/issues/10219
This commit is contained in:
parent
f9d8ec6137
commit
b1658fdf9a
|
@ -1417,7 +1417,7 @@ void SCH_EDIT_FRAME::CheckForAutoSaveFile( const wxFileName& aFileName )
|
|||
|
||||
// Attempt to back up the last schematic file before overwriting it with the auto
|
||||
// save file.
|
||||
if( !wxRenameFile( recoveredFn.GetFullPath(), backupFn.GetFullPath() ) )
|
||||
if( !wxCopyFile( recoveredFn.GetFullPath(), backupFn.GetFullPath() ) )
|
||||
{
|
||||
unrecoveredFiles.Add( recoveredFn.GetFullPath() );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue