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
This commit is contained in:
Maciej Suminski 2018-02-05 16:51:42 +01:00
parent fe62760f39
commit 351a8d72b8
1 changed files with 10 additions and 1 deletions

View File

@ -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