From ba32ccbbb290cae84bbf216c84e5c3e09a46afb6 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Tue, 21 Jul 2015 15:43:19 -0400 Subject: [PATCH] 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. --- kicad/prjconfig.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/kicad/prjconfig.cpp b/kicad/prjconfig.cpp index bcac13de69..54b60607bb 100644 --- a/kicad/prjconfig.cpp +++ b/kicad/prjconfig.cpp @@ -258,8 +258,13 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event ) 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 - 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( _( "KiCad project file '%s' not found" ), @@ -269,6 +274,12 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event ) 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 ); title = wxT( "KiCad " ) + GetBuildVersion() + wxT( ' ' ) + prj_filename; @@ -295,8 +306,9 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event ) PrintPrjInfo(); } + /* 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 ) { @@ -307,7 +319,7 @@ void KICAD_MANAGER_FRAME::OnCreateProjectFromTemplate( wxCommandEvent& event ) if( dlg.ShowModal() == wxID_CANCEL ) 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; fn.AssignDir( dlg.GetPath() ); fn.SetName( dlg.GetPath().AfterLast( SEP() ) );