Eeschema: fix broken new sheet path comparison on windows.
Using wxFileName::GetPath( wxPATH_WITH_SEPARATOR ) does not include the drive specifier (A:, B:, C:, etc.) on windows which fails the comparison with the project path 100% of the time. wxFileName::GetPathWithSep() solves the issue nicely. Fixes https://gitlab.com/kicad/code/kicad/issues/5077
This commit is contained in:
parent
d1006138fd
commit
03423f13a1
|
@ -171,8 +171,7 @@ bool SCH_EDIT_FRAME::LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHier
|
|||
|
||||
// If the loaded schematic is in a different folder from the current project and
|
||||
// it contains hierarchical sheets, the hierarchical sheet paths need to be updated.
|
||||
if( fileName.GetPath( wxPATH_GET_SEPARATOR ) != Prj().GetProjectPath()
|
||||
&& newSheet->CountSheets() )
|
||||
if( fileName.GetPathWithSep() != Prj().GetProjectPath() && newSheet->CountSheets() )
|
||||
{
|
||||
// Give the user the option to choose relative path if possible.
|
||||
if( tmp.MakeRelativeTo( Prj().GetProjectPath() ) )
|
||||
|
@ -204,7 +203,7 @@ bool SCH_EDIT_FRAME::LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHier
|
|||
wxMessageDialog::ButtonLabel okButtonLabel( _( "Continue Load" ) );
|
||||
wxMessageDialog::ButtonLabel cancelButtonLabel( _( "Cancel Load" ) );
|
||||
|
||||
if( fileName.GetPath( wxPATH_GET_SEPARATOR ) == Prj().GetProjectPath()
|
||||
if( fileName.GetPathWithSep() == Prj().GetProjectPath()
|
||||
&& !prjScreens.HasSchematic( fullFilename ) )
|
||||
{
|
||||
// A schematic in the current project path that isn't part of the current project.
|
||||
|
@ -231,7 +230,7 @@ bool SCH_EDIT_FRAME::LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHier
|
|||
return false;
|
||||
}
|
||||
}
|
||||
else if( fileName.GetPath( wxPATH_GET_SEPARATOR ) != Prj().GetProjectPath() )
|
||||
else if( fileName.GetPathWithSep() != Prj().GetProjectPath() )
|
||||
{
|
||||
// A schematic loaded from a path other than the current project path.
|
||||
|
||||
|
|
Loading…
Reference in New Issue