Browse Source

Better test whether a symbol library is saved to its original file

File names can be reliable compared only after normalization. The
problem is the easiest to observe on Windows, where one can use slash or
backslash as path separator, so even though C:/file.txt and C:\file.txt
pointed to the same file - simple string comparison would indicate they
are different files.

Fixes: lp:1744724
* https://bugs.launchpad.net/kicad/+bug/1744724
pull/5/merge
Maciej Suminski 9 years ago
parent
commit
351a8d72b8
  1. 11
      eeschema/lib_manager.cpp

11
eeschema/lib_manager.cpp

@ -165,9 +165,18 @@ bool LIB_MANAGER::SaveLibrary( const wxString& aLibrary, const wxString& aFileNa
}
// clear the deleted parts buffer only if data is saved to the original file
wxFileName original, destination( aFileName );
auto row = symTable()->FindRow( aLibrary );
if( res && row && row->GetFullURI( true ) == aFileName )
if( row )
{
original = row->GetFullURI( true );
original.Normalize();
}
destination.Normalize();
if( res && original == destination )
libBuf.ClearDeletedBuffer();
}
else

Loading…
Cancel
Save