KiCad: do not create noname.pro file in KiCad binary path. (fixes lp:1473079)
* If a valid project name was not specified or the default project name was not specified, do no automatically create noname.pro which ends up in the current working directory. On Linux this is generally not writable by the user but on windows it usually is and create an unwanted noname.pro file.
This commit is contained in:
parent
3921f78ac2
commit
ba32ccbbb2
|
@ -258,8 +258,13 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event )
|
||||||
|
|
||||||
wxString nameless_prj = NAMELESS_PROJECT wxT( ".pro" );
|
wxString nameless_prj = NAMELESS_PROJECT wxT( ".pro" );
|
||||||
|
|
||||||
|
wxLogDebug( wxT( "%s: %s" ),
|
||||||
|
GetChars( wxFileName( prj_filename ).GetFullName() ),
|
||||||
|
GetChars( nameless_prj ) );
|
||||||
|
|
||||||
// Check if project file exists and if it is not noname.pro
|
// Check if project file exists and if it is not noname.pro
|
||||||
if( !wxFileExists( prj_filename ) && !wxFileName( prj_filename ).GetFullName().IsSameAs( nameless_prj ) )
|
if( !wxFileExists( prj_filename )
|
||||||
|
&& !wxFileName( prj_filename ).GetFullName().IsSameAs( nameless_prj ) )
|
||||||
{
|
{
|
||||||
wxString msg = wxString::Format( _(
|
wxString msg = wxString::Format( _(
|
||||||
"KiCad project file '%s' not found" ),
|
"KiCad project file '%s' not found" ),
|
||||||
|
@ -269,6 +274,12 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Either this is the first time kicad has been run or one of the projects in the
|
||||||
|
// history list is no longer valid. This prevents kicad from automatically creating
|
||||||
|
// a noname.pro file in the same folder as the kicad binary.
|
||||||
|
if( wxFileName( prj_filename ).GetFullName().IsSameAs( nameless_prj ) )
|
||||||
|
return;
|
||||||
|
|
||||||
Prj().ConfigLoad( Pgm().SysSearch(), GeneralGroupName, s_KicadManagerParams );
|
Prj().ConfigLoad( Pgm().SysSearch(), GeneralGroupName, s_KicadManagerParams );
|
||||||
|
|
||||||
title = wxT( "KiCad " ) + GetBuildVersion() + wxT( ' ' ) + prj_filename;
|
title = wxT( "KiCad " ) + GetBuildVersion() + wxT( ' ' ) + prj_filename;
|
||||||
|
@ -295,8 +306,9 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event )
|
||||||
PrintPrjInfo();
|
PrintPrjInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Creates a new project folder, copy a template into this new folder.
|
/* Creates a new project folder, copy a template into this new folder.
|
||||||
* and open this new projrct as working project
|
* and open this new project as working project
|
||||||
*/
|
*/
|
||||||
void KICAD_MANAGER_FRAME::OnCreateProjectFromTemplate( wxCommandEvent& event )
|
void KICAD_MANAGER_FRAME::OnCreateProjectFromTemplate( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
|
@ -307,7 +319,7 @@ void KICAD_MANAGER_FRAME::OnCreateProjectFromTemplate( wxCommandEvent& event )
|
||||||
if( dlg.ShowModal() == wxID_CANCEL )
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Buils the project .pro filename, from the new project folder name
|
// Builds the project .pro filename, from the new project folder name
|
||||||
wxFileName fn;
|
wxFileName fn;
|
||||||
fn.AssignDir( dlg.GetPath() );
|
fn.AssignDir( dlg.GetPath() );
|
||||||
fn.SetName( dlg.GetPath().AfterLast( SEP() ) );
|
fn.SetName( dlg.GetPath().AfterLast( SEP() ) );
|
||||||
|
|
Loading…
Reference in New Issue