Commit 83d66680 authored by Luis's avatar Luis Committed by Wayne Stambaugh

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.
parent f1295385
......@@ -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'" ),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment