From 775ce3993cffc0b38eaaed7bce76da3d08f85c37 Mon Sep 17 00:00:00 2001 From: Brian Sidebotham Date: Fri, 7 Feb 2014 18:17:58 +0000 Subject: [PATCH] * Fix linux location for system project templates --- kicad/prjconfig.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/kicad/prjconfig.cpp b/kicad/prjconfig.cpp index 8d19791e24..93da24b603 100644 --- a/kicad/prjconfig.cpp +++ b/kicad/prjconfig.cpp @@ -85,12 +85,23 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxString aPrjFullFileName, if( !envStr.EndsWith( sep ) ) envStr += sep; - templatePath = envStr + wxT("template") + sep; + templatePath = envStr + wxT( "template" ) + sep; } else { - templatePath = wxPathOnly(wxStandardPaths::Get().GetExecutablePath()) + + // The standard path should be in the share directory for kicad. As + // it is normal on Windows to only have the share directory and not + // the kicad sub-directory we fall back to that if the directory + // doesn't exist + templatePath = wxPathOnly( wxStandardPaths::Get().GetExecutablePath() ) + + sep + wxT( ".." ) + sep + wxT( "share" ) + sep + wxT( "kicad" ) + + sep + wxT( "template" ) + sep; + + if( !wxDirExists( templatePath.GetFullPath() ) ) + { + templatePath = wxPathOnly( wxStandardPaths::Get().GetExecutablePath() ) + sep + wxT( ".." ) + sep + wxT( "share" ) + sep + wxT( "template" ) + sep; + } } ps->AddPage( _( "System Templates" ), templatePath );