From c99f6722dfa2c676e7137616f22155a268bd4eb8 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 3 Dec 2015 16:53:36 +0100 Subject: [PATCH] Messages created by IO_ERROR and PARSE_ERROR: the short filename of the kicad source file is printed instead of the full filename. The full filename of a Kicad source file has no meaning for users. --- common/richio.cpp | 12 ++++++++++-- include/richio.h | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/common/richio.cpp b/common/richio.cpp index 286825a81f..d24f6b0e52 100644 --- a/common/richio.cpp +++ b/common/richio.cpp @@ -105,8 +105,12 @@ std::string StrPrintf( const char* format, ... ) void IO_ERROR::init( const char* aThrowersFile, const char* aThrowersLoc, const wxString& aMsg ) { + // The throwers filename is a full filename, depending on Kicad source location. + // a short filename will be printed (it is better for user, the full filename has no meaning). + wxString srcname = wxString::FromUTF8( aThrowersFile ); + errorText.Printf( IO_FORMAT, aMsg.GetData(), - wxString::FromUTF8( aThrowersFile ).GetData(), + srcname.AfterLast( '/' ).GetData(), wxString::FromUTF8( aThrowersLoc ).GetData() ); } @@ -121,9 +125,13 @@ void PARSE_ERROR::init( const char* aThrowersFile, const char* aThrowersLoc, lineNumber = aLineNumber; byteIndex = aByteIndex; + // The throwers filename is a full filename, depending on Kicad source location. + // a short filename will be printed (it is better for user, the full filename has no meaning). + wxString srcname = wxString::FromUTF8( aThrowersFile ); + errorText.Printf( PARSE_FORMAT, aMsg.GetData(), aSource.GetData(), aLineNumber, aByteIndex, - wxString::FromUTF8( aThrowersFile ).GetData(), + srcname.AfterLast( '/' ).GetData(), wxString::FromUTF8( aThrowersLoc ).GetData() ); } diff --git a/include/richio.h b/include/richio.h index 4d344b9a86..f47f7475ed 100644 --- a/include/richio.h +++ b/include/richio.h @@ -75,7 +75,7 @@ std::string #define IO_FORMAT _( "IO_ERROR: %s\nfrom %s : %s" ) -#define PARSE_FORMAT _( "PARSE_ERROR: %s in input/source\n'%s'\nline %d\noffset %d\nfrom %s : %s" ) +#define PARSE_FORMAT _( "PARSE_ERROR: %s in input/source\n'%s'\nline %d offset %d\nfrom %s : %s" ) // references: // http://stackoverflow.com/questions/2670816/how-can-i-use-the-compile-time-constant-line-in-a-string