eeschema: minor fixes in DIALOG_SCH_SHEET_PROPS:

- test for empty fileName
- ensure the new filename has the right extension.
This commit is contained in:
jean-pierre charras 2020-04-01 18:30:05 +02:00
parent 9a67dc56f9
commit 6730313ab7
1 changed files with 12 additions and 1 deletions

View File

@ -242,7 +242,18 @@ bool DIALOG_SCH_SHEET_PROPS::TransferDataFromWindow()
return false; return false;
wxString newRelativeNativeFilename = m_fields->at( SHEETFILENAME ).GetText(); wxString newRelativeNativeFilename = m_fields->at( SHEETFILENAME ).GetText();
wxString newRelativeFilename = newRelativeNativeFilename;
if( newRelativeNativeFilename.IsEmpty() )
{
wxMessageBox( _( "A sheet cannot have an empty filename" ) );
return false;
}
// Ensure the filename extension is OK
wxFileName fn( newRelativeNativeFilename );
fn.SetExt( LegacySchematicFileExtension );
wxString newRelativeFilename = fn.GetFullPath();
// Inside Eeschema, filenames are stored using unix notation // Inside Eeschema, filenames are stored using unix notation
newRelativeFilename.Replace( wxT( "\\" ), wxT( "/" ) ); newRelativeFilename.Replace( wxT( "\\" ), wxT( "/" ) );