51 return SafeReadFile( aFileName, wxS(
"r" ) ).Left( 7 ).Upper() == wxS(
"VERSION" );
61 const std::map<std::string, UTF8>* aProperties )
63 wxASSERT( !aFileName || aSchematic );
69 wxCHECK_MSG( aSchematic->
IsValid(),
nullptr,
"Can't append to a schematic with no root!" );
70 rootSheet = aAppendToMe;
92 wxFileName ltspiceDataDir;
94 if( wxGetEnv( wxS(
"KICAD_LTSPICE_LIB" ), &libOverride ) && wxDirExists( libOverride ) )
95 ltspiceDataDir = wxFileName( libOverride, wxEmptyString );
98 if( !ltspiceDataDir.IsOk() )
101 ltspiceDataDir.AppendDir( wxS(
"LTspice" ) );
102 ltspiceDataDir.AppendDir( wxS(
"lib" ) );
105 if( !ltspiceDataDir.DirExists() )
109 ltspiceDataDir.RemoveLastDir();
110 ltspiceDataDir.AppendDir( wxS(
"LTspice" ) );
111 ltspiceDataDir.AppendDir( wxS(
"lib" ) );
115 if( !ltspiceDataDir.DirExists() )
118 ltspiceDataDir = wxFileName(
"/Applications/LTspice.app/Contents/SharedSupport/ltspice/support/ltspice/drive_c/"
119 "users/crossover/AppData/Local/LTspice/lib",
129 wxFileName::GetPathSeparator() +
"LTspice*", wxDIR );
131 while( !foundFile.empty() )
133 ltspiceDataDir = wxFileName(foundFile, wxEmptyString);
134 ltspiceDataDir.AppendDir( wxS(
"lib" ) );
136 if( ltspiceDataDir.DirExists() )
139 foundFile = wxFindNextFile();
143 if( !ltspiceDataDir.DirExists() )
145 wxFileName fn( aFileName );
146 fn.SetFullName( wxEmptyString );
147 fn.AppendDir(
"lib" );
149 wxString localLibPath = fn.GetFullPath();
151 if( wxDirExists( localLibPath ) )
153 ltspiceDataDir = localLibPath;
157 m_reporter->Report( wxString::Format(
_(
"Unable to find LTspice symbols.\nInstall "
158 "LTspice or put its library files into %s" ),
REPORTER * m_reporter
Reporter to log errors/warnings to, may be nullptr.
PROGRESS_REPORTER * m_progressReporter
Progress reporter to track the progress of the operation, may be nullptr.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
virtual const wxString What() const
A composite of Problem() and Where()
void Load(SCHEMATIC *aSchematic, SCH_SHEET *aRootSheet, const wxFileName &aLibraryFileName, REPORTER *aReporter)
The main function responsible for loading the .asc and .asy files.
Holds all the data relating to one schematic.
bool IsValid() const
A simple test if the schematic is loaded, not a complete one.
void SetTopLevelSheets(const std::vector< SCH_SHEET * > &aSheets)
Replace the top level sheets, rebuilding the hierarchy and connectivity around them.
int GetModifyHash() const override
schematic PLUGIN for LTspice (*.asc) and (.asy) format.
SCH_SHEET * LoadSchematicFile(const wxString &aFileName, SCHEMATIC *aSchematic, SCH_SHEET *aAppendToMe=nullptr, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Load information from some input file format that this SCH_IO implementation knows about,...
bool CanReadSchematicFile(const wxString &aFileName) const override
Checks if this SCH_IO can read the specified schematic file.
virtual bool CanReadSchematicFile(const wxString &aFileName) const
Checks if this SCH_IO can read the specified schematic file.
void SetFileName(const wxString &aFileName)
Set the file name for this screen to aFileName.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
void SetFileName(const wxString &aFilename)
void SyncUuidToScreen()
Take the identity of the screen this sheet owns.
SCH_SCREEN * GetScreen() const
void SetScreen(SCH_SCREEN *aScreen)
Set the SCH_SCREEN associated with this sheet to aScreen.
wxString SafeReadFile(const wxString &aFilePath, const wxString &aReadType)
Nominally opens a file and reads it into a string.