7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 00:21:25 +00:00

Fix path comparison in design blocks on Windows.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19950
This commit is contained in:
Alex Shvartzkop 2025-02-15 22:14:19 +03:00
parent 667bafc8bb
commit 4d3b2c0cca

View File

@ -353,10 +353,12 @@ void DESIGN_BLOCK_IO::DesignBlockSave( const wxString& aLibra
THROW_IO_ERROR( _( "Design block does not have a valid library ID." ) );
}
if( !wxFileExists( aDesignBlock->GetSchematicFile() ) )
wxFileName schematicFile( aDesignBlock->GetSchematicFile() );
if( !schematicFile.FileExists() )
{
THROW_IO_ERROR( wxString::Format( _( "Schematic source file '%s' does not exist." ),
aDesignBlock->GetSchematicFile() ) );
schematicFile.GetFullPath() ) );
}
// Create the design block folder
@ -380,14 +382,14 @@ void DESIGN_BLOCK_IO::DesignBlockSave( const wxString& aLibra
// If the source and destination files are the same, then we don't need to copy the file
// as we are just updating the metadata
if( aDesignBlock->GetSchematicFile() != dbSchematicFile )
if( schematicFile.GetFullPath() != dbSchematicFile )
{
// Copy the source sheet file to the design block folder, under the design block name
if( !wxCopyFile( aDesignBlock->GetSchematicFile(), dbSchematicFile ) )
if( !wxCopyFile( schematicFile.GetFullPath(), dbSchematicFile ) )
{
THROW_IO_ERROR( wxString::Format(
_( "Schematic file '%s' could not be saved as design block at '%s'." ),
aDesignBlock->GetSchematicFile().GetData(), dbSchematicFile ) );
schematicFile.GetFullPath(), dbSchematicFile ) );
}
}