Revert absolute-path asserts and fix off-by-one bug.

Fixes: lp:1767582
* https://bugs.launchpad.net/kicad/+bug/1767582
This commit is contained in:
Jeff Young 2018-09-15 22:35:32 +01:00
parent ae5183f614
commit e45afdb912
3 changed files with 8 additions and 7 deletions

View File

@ -78,9 +78,7 @@ void PROJECT::SetProjectFullName( const wxString& aFullPathAndName )
m_project_name = aFullPathAndName;
// There's no guarantee that this path is absolute. For instance, a relative
// path might have been passed via the command line.
// wxASSERT( m_project_name.IsAbsolute() );
wxASSERT( m_project_name.IsAbsolute() );
wxASSERT( m_project_name.GetExt() == ProjectFileExtension );

View File

@ -365,11 +365,11 @@ bool PGM_SINGLE_TOP::OnPgmInit()
argSet.push_back( App().argv[i] );
}
// special attention to the first argument: argv[1] (==argSet[0])
wxFileName argv1( argSet[0] );
if( argc - args_offset > 1 )
// special attention to a single argument: argv[1] (==argSet[0])
if( argc == args_offset + 1 )
{
wxFileName argv1( argSet[0] );
#if defined(PGM_DATA_FILE_EXT)
// PGM_DATA_FILE_EXT, if present, may be different for each compile,
// it may come from CMake on the compiler command line, but often does not.

View File

@ -201,6 +201,9 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
wxString fullFileName( aFileSet[0] );
// We insist on caller sending us an absolute path, if it does not, we say it's a bug.
wxASSERT_MSG( wxFileName( fullFileName ).IsAbsolute(), wxT( "Path is not absolute!" ) );
if( !LockFile( fullFileName ) )
{
wxString msg = wxString::Format( _( "Schematic file \"%s\" is already open." ),