Browse Source

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.
pull/1/head
Luis 11 years ago
committed by Wayne Stambaugh
parent
commit
83d666806c
  1. 6
      pcbnew/kicad_plugin.cpp
  2. 2
      pcbnew/legacy_plugin.cpp

6
pcbnew/kicad_plugin.cpp

@ -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'" ),

2
pcbnew/legacy_plugin.cpp

@ -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…
Cancel
Save