LTspice import: add LTspice 17.1 Windows library path.
This commit is contained in:
parent
c652abecff
commit
f8f7b84f13
|
@ -86,11 +86,20 @@ SCH_SHEET* SCH_LTSPICE_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSche
|
|||
SYMBOL_LIB_TABLE* libTable = aSchematic->Prj().SchSymbolLibTable();
|
||||
|
||||
wxCHECK_MSG( libTable, nullptr, "Could not load symbol lib table." );
|
||||
|
||||
wxFileName ltspiceDataDir( KIPLATFORM::ENV::GetUserDataPath(), wxEmptyString );
|
||||
ltspiceDataDir.RemoveLastDir(); // "kicad"
|
||||
|
||||
// Windows path: C:\Users\USERNAME\AppData\Local\LTspice\lib
|
||||
wxFileName ltspiceDataDir( KIPLATFORM::ENV::GetUserLocalDataPath(), wxEmptyString );
|
||||
ltspiceDataDir.AppendDir( wxS( "LTspice" ) );
|
||||
ltspiceDataDir.AppendDir( "lib" );
|
||||
ltspiceDataDir.AppendDir( wxS( "lib" ) );
|
||||
|
||||
if( !ltspiceDataDir.DirExists() )
|
||||
{
|
||||
// Mac path
|
||||
wxFileName ltspiceDataDir( KIPLATFORM::ENV::GetUserDataPath(), wxEmptyString );
|
||||
ltspiceDataDir.RemoveLastDir(); // "kicad"
|
||||
ltspiceDataDir.AppendDir( wxS( "LTspice" ) );
|
||||
ltspiceDataDir.AppendDir( wxS( "lib" ) );
|
||||
}
|
||||
|
||||
if( !ltspiceDataDir.DirExists() )
|
||||
{
|
||||
|
@ -100,7 +109,7 @@ SCH_SHEET* SCH_LTSPICE_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSche
|
|||
while( !foundFile.empty() )
|
||||
{
|
||||
ltspiceDataDir = wxFileName(foundFile, wxEmptyString);
|
||||
ltspiceDataDir.AppendDir( "lib" );
|
||||
ltspiceDataDir.AppendDir( wxS( "lib" ) );
|
||||
|
||||
if( ltspiceDataDir.DirExists() )
|
||||
break;
|
||||
|
|
|
@ -115,6 +115,12 @@ wxString KIPLATFORM::ENV::GetUserDataPath()
|
|||
}
|
||||
|
||||
|
||||
wxString KIPLATFORM::ENV::GetUserLocalDataPath()
|
||||
{
|
||||
return g_get_user_data_dir();
|
||||
}
|
||||
|
||||
|
||||
wxString KIPLATFORM::ENV::GetUserCachePath()
|
||||
{
|
||||
return g_get_user_cache_dir();
|
||||
|
|
|
@ -72,6 +72,13 @@ namespace KIPLATFORM
|
|||
*/
|
||||
wxString GetUserDataPath();
|
||||
|
||||
/**
|
||||
* Retrieves the operating system specific path for a user's local data store
|
||||
*
|
||||
* @return User config path
|
||||
*/
|
||||
wxString GetUserLocalDataPath();
|
||||
|
||||
/**
|
||||
* Retrieves the operating system specific path for user's application cache
|
||||
*
|
||||
|
|
|
@ -116,6 +116,20 @@ wxString KIPLATFORM::ENV::GetUserDataPath()
|
|||
}
|
||||
|
||||
|
||||
wxString KIPLATFORM::ENV::GetUserLocalDataPath()
|
||||
{
|
||||
// If called by a python script in stand-alone (outside KiCad), wxStandardPaths::Get()
|
||||
// complains about not existing app. so use a dummy app
|
||||
if( wxTheApp == nullptr )
|
||||
{
|
||||
wxApp dummy;
|
||||
return wxStandardPaths::Get().GetUserLocalDataDir();
|
||||
}
|
||||
|
||||
return wxStandardPaths::Get().GetUserLocalDataDir();
|
||||
}
|
||||
|
||||
|
||||
wxString KIPLATFORM::ENV::GetUserCachePath()
|
||||
{
|
||||
// Unfortunately AppData/Local is the closest analog to "Cache" directories of other platforms
|
||||
|
|
|
@ -91,6 +91,12 @@ wxString KIPLATFORM::ENV::GetUserDataPath()
|
|||
}
|
||||
|
||||
|
||||
wxString KIPLATFORM::ENV::GetUserLocalDataPath()
|
||||
{
|
||||
return wxStandardPaths::Get().GetUserLocalDataDir();
|
||||
}
|
||||
|
||||
|
||||
wxString KIPLATFORM::ENV::GetUserCachePath()
|
||||
{
|
||||
NSURL* url = [[NSFileManager defaultManager] URLForDirectory:NSCachesDirectory
|
||||
|
|
Loading…
Reference in New Issue