Fix temporary file bug when saving modified footprints. (fixes lp:1384550)
* Use wxRenameFile which falls back to a file copy and file remove when wxRename fails.
This commit is contained in:
parent
f12953855e
commit
83d666806c
|
@ -246,7 +246,11 @@ void FP_CACHE::Save()
|
|||
|
||||
wxRemove( fn.GetFullPath() ); // it is not an error if this does not exist
|
||||
|
||||
if( wxRename( tempFileName, fn.GetFullPath() ) )
|
||||
// Even on linux you can see an _intermittent_ error when calling wxRename(),
|
||||
// and it is fully inexplicable. See if this dodges the error.
|
||||
wxMilliSleep( 250L );
|
||||
|
||||
if( !wxRenameFile( tempFileName, fn.GetFullPath() ) )
|
||||
{
|
||||
wxString msg = wxString::Format(
|
||||
_( "Cannot rename temporary file '%s' to footprint library file '%s'" ),
|
||||
|
|
|
@ -4487,7 +4487,7 @@ void LP_CACHE::Save()
|
|||
// and it is fully inexplicable. See if this dodges the error.
|
||||
wxMilliSleep( 250L );
|
||||
|
||||
if( wxRename( tempFileName, m_lib_path ) )
|
||||
if( !wxRenameFile( tempFileName, m_lib_path ) )
|
||||
{
|
||||
THROW_IO_ERROR( wxString::Format(
|
||||
_( "Unable to rename tempfile '%s' to library file '%s'" ),
|
||||
|
|
Loading…
Reference in New Issue