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