From d34639b79b499c8eac18fc30a8372a8ed3dfdf3c Mon Sep 17 00:00:00 2001 From: Miguel Angel Ajo Date: Sun, 10 Mar 2013 02:35:24 +0100 Subject: [PATCH] Project templates now can find the system templates from KICAD environment variable --- kicad/prjconfig.cpp | 13 ++++++++++++- kicad/project_template.h | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/kicad/prjconfig.cpp b/kicad/prjconfig.cpp index 829ff0b1d7..f136ff159b 100644 --- a/kicad/prjconfig.cpp +++ b/kicad/prjconfig.cpp @@ -69,9 +69,20 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxString aPrjFullFileName, boo { DIALOG_TEMPLATE_SELECTOR* ps = new DIALOG_TEMPLATE_SELECTOR( this ); + wxFileName templatePath; + // Add a new tab for system templates - wxFileName templatePath = wxPathOnly(wxStandardPaths::Get().GetExecutablePath()) + + if( ::wxGetEnv( wxT( "KICAD" ), NULL ) ) + { + wxString kicadEnv; + wxGetEnv( wxT( "KICAD"), &kicadEnv ); + templatePath = kicadEnv + SEP() + wxT("template")+SEP(); + } + else + { + wxFileName templatePath = wxPathOnly(wxStandardPaths::Get().GetExecutablePath()) + SEP() + wxT( ".." ) + SEP() + wxT( "share" ) + SEP() + wxT( "template" ) + SEP(); + } ps->AddPage( _( "System Templates" ), templatePath ); diff --git a/kicad/project_template.h b/kicad/project_template.h index 6b6344e6b4..c97ba5e4ad 100644 --- a/kicad/project_template.h +++ b/kicad/project_template.h @@ -97,6 +97,7 @@ wxStandardPaths::GetExecutableDir()/../share/template/ wxStandardPaths::GetUserDataDir()/templates/ wxGetEnv(wxT("KICAD_TEMPLATES")) + wxGetEnv(wxT("KICAD"))/template/ */