Create a stock scripting path helper
This commit is contained in:
parent
2bbc25a630
commit
2807a37fc0
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <kiplatform/environment.h>
|
||||
#include <paths.h>
|
||||
#include <pgm_base.h>
|
||||
#include <settings/settings_manager.h>
|
||||
|
||||
wxString PATHS::GetUserScriptingPath()
|
||||
|
@ -41,4 +42,29 @@ wxString PATHS::GetDefaultUserProjectsPath()
|
|||
tmp.AppendDir( "projects" );
|
||||
|
||||
return tmp.GetFullPath();
|
||||
}
|
||||
|
||||
|
||||
wxString PATHS::GetStockScriptingPath()
|
||||
{
|
||||
wxString path;
|
||||
|
||||
if( wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) )
|
||||
{
|
||||
// Allow debugging from build dir by placing a "scripting" folder in the build root
|
||||
path = Pgm().GetExecutablePath() + wxT( "../scripting" );
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO(snh) break out the directory functions into KIPLATFORM
|
||||
#if defined( __WXMAC__ )
|
||||
path = GetOSXKicadDataDir() + wxT( "/scripting" );
|
||||
#elif defined( __WXMSW__ )
|
||||
path = Pgm().GetExecutablePath() + wxT( "../share/kicad/scripting" );
|
||||
#else
|
||||
path = wxString( KICAD_DATA ) + wxS( "/scripting" );
|
||||
#endif
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
|
@ -8,6 +8,7 @@ public:
|
|||
static wxString GetUserScriptingPath();
|
||||
static wxString GetUserTemplatesPath();
|
||||
static wxString GetDefaultUserProjectsPath();
|
||||
static wxString GetStockScriptingPath();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -676,22 +676,7 @@ wxString PyScriptingPath( bool aUserPath )
|
|||
}
|
||||
else
|
||||
{
|
||||
if( wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) )
|
||||
{
|
||||
// Allow debugging from build dir by placing a "scripting" folder in the build root
|
||||
path = Pgm().GetExecutablePath() + wxT( "../scripting" );
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO(snh) break out the directory functions into KIPLATFORM
|
||||
#if defined( __WXMAC__ )
|
||||
path = GetOSXKicadDataDir() + wxT( "/scripting" );
|
||||
#elif defined( __WXMSW__ )
|
||||
path = Pgm().GetExecutablePath() + wxT( "../share/kicad/scripting" );
|
||||
#else
|
||||
path = wxString( KICAD_DATA ) + wxS( "/scripting" );
|
||||
#endif
|
||||
}
|
||||
path = PATHS::GetStockScriptingPath();
|
||||
}
|
||||
|
||||
wxFileName scriptPath( path );
|
||||
|
|
Loading…
Reference in New Issue