From 2739cdbd43ae151cf70b96652675d6e8a6665cf4 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 13 Jul 2021 19:58:25 +0100 Subject: [PATCH] Add error message logging to opening of drawing sheet. --- common/drawing_sheet/drawing_sheet_reader.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/common/drawing_sheet/drawing_sheet_reader.cpp b/common/drawing_sheet/drawing_sheet_reader.cpp index 78ca03bdef..c7bb6d6070 100644 --- a/common/drawing_sheet/drawing_sheet_reader.cpp +++ b/common/drawing_sheet/drawing_sheet_reader.cpp @@ -879,19 +879,15 @@ bool DS_DATA_MODEL::LoadDrawingSheet( const wxString& aFullFileName, bool Append if( fullFileName.IsEmpty() ) wxGetEnv( wxT( "KICAD_WKSFILE" ), &fullFileName ); - if( fullFileName.IsEmpty() ) { - #if 0 - if( !fullFileName.IsEmpty() ) - wxLogMessage( wxT( "Drawing sheet file <%s> not found" ), fullFileName.GetData() ); - #endif SetDefaultLayout(); return true; // we assume its fine / default init } if( !wxFileExists( fullFileName ) ) { + wxLogMessage( _( "Drawing sheet '%s' not found." ), fullFileName ); SetDefaultLayout(); return false; } @@ -901,8 +897,11 @@ bool DS_DATA_MODEL::LoadDrawingSheet( const wxString& aFullFileName, bool Append if( ! wksFile.IsOpened() ) { + wxLogMessage( _( "Drawing sheet '%s' could not be opened." ), fullFileName ); + if( !Append ) SetDefaultLayout(); + return false; } @@ -911,7 +910,7 @@ bool DS_DATA_MODEL::LoadDrawingSheet( const wxString& aFullFileName, bool Append if( wksFile.Read( buffer.get(), filelen ) != filelen ) { - wxLogMessage( _( "The file '%s' was not fully read." ), fullFileName.GetData() ); + wxLogMessage( _( "Drawing sheet '%s' was not fully read." ), fullFileName.GetData() ); return false; } else