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.
This commit is contained in:
jean-pierre charras 2015-12-03 16:53:36 +01:00
parent 23a0dddea9
commit c99f6722df
2 changed files with 11 additions and 3 deletions

View File

@ -105,8 +105,12 @@ std::string StrPrintf( const char* format, ... )
void IO_ERROR::init( const char* aThrowersFile, const char* aThrowersLoc, const wxString& aMsg ) 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(), errorText.Printf( IO_FORMAT, aMsg.GetData(),
wxString::FromUTF8( aThrowersFile ).GetData(), srcname.AfterLast( '/' ).GetData(),
wxString::FromUTF8( aThrowersLoc ).GetData() ); wxString::FromUTF8( aThrowersLoc ).GetData() );
} }
@ -121,9 +125,13 @@ void PARSE_ERROR::init( const char* aThrowersFile, const char* aThrowersLoc,
lineNumber = aLineNumber; lineNumber = aLineNumber;
byteIndex = aByteIndex; 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(), errorText.Printf( PARSE_FORMAT, aMsg.GetData(), aSource.GetData(),
aLineNumber, aByteIndex, aLineNumber, aByteIndex,
wxString::FromUTF8( aThrowersFile ).GetData(), srcname.AfterLast( '/' ).GetData(),
wxString::FromUTF8( aThrowersLoc ).GetData() ); wxString::FromUTF8( aThrowersLoc ).GetData() );
} }

View File

@ -75,7 +75,7 @@ std::string
#define IO_FORMAT _( "IO_ERROR: %s\nfrom %s : %s" ) #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: // references:
// http://stackoverflow.com/questions/2670816/how-can-i-use-the-compile-time-constant-line-in-a-string // http://stackoverflow.com/questions/2670816/how-can-i-use-the-compile-time-constant-line-in-a-string