From 6730313ab76b6db609e7ff12a7067a3eaf80f059 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 1 Apr 2020 18:30:05 +0200 Subject: [PATCH] eeschema: minor fixes in DIALOG_SCH_SHEET_PROPS: - test for empty fileName - ensure the new filename has the right extension. --- eeschema/dialogs/dialog_sch_sheet_props.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/eeschema/dialogs/dialog_sch_sheet_props.cpp b/eeschema/dialogs/dialog_sch_sheet_props.cpp index fac3098f56..f21679d167 100644 --- a/eeschema/dialogs/dialog_sch_sheet_props.cpp +++ b/eeschema/dialogs/dialog_sch_sheet_props.cpp @@ -242,7 +242,18 @@ bool DIALOG_SCH_SHEET_PROPS::TransferDataFromWindow() return false; 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 newRelativeFilename.Replace( wxT( "\\" ), wxT( "/" ) );