Merge pull request #642 from ra3xdh/639_fix

Fix save netlist from CLI
This commit is contained in:
Vadim Kuznetsov 2024-03-13 11:16:28 +01:00 committed by GitHub
commit 801da6c1a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 9 deletions

View File

@ -123,15 +123,17 @@ void Ngspice::createNetlist(QTextStream &stream, int ,
stream << "\n.control\n\n"; //execute simulations
if (!QucsMain->ProjName.isEmpty()) {
// always load osdi from the project directory
QStringList osdi_ext;
osdi_ext<<"*.osdi";
QStringList osdi_files = QucsSettings.QucsWorkDir.entryList(osdi_ext,QDir::Files);
for(const auto &file : osdi_files) {
QString abs_file = QucsSettings.QucsWorkDir.absolutePath() +
QDir::separator() + file;
stream<<QString("pre_osdi '%1'\n").arg(abs_file);
if (QucsMain != nullptr) { // if not run from CLI
if (!QucsMain->ProjName.isEmpty()) {
// always load osdi from the project directory
QStringList osdi_ext;
osdi_ext<<"*.osdi";
QStringList osdi_files = QucsSettings.QucsWorkDir.entryList(osdi_ext,QDir::Files);
for(const auto &file : osdi_files) {
QString abs_file = QucsSettings.QucsWorkDir.absolutePath() +
QDir::separator() + file;
stream<<QString("pre_osdi '%1'\n").arg(abs_file);
}
}
}

View File

@ -369,6 +369,7 @@ Schematic *openSchematic(QString schematic)
int doNetlist(QString schematic, QString netlist)
{
QucsSettings.DefaultSimulator = spicecompat::simQucsator;
Module::registerModules();
Schematic *sch = openSchematic(schematic);
if (sch == NULL) {
return 1;
@ -473,6 +474,7 @@ int runXyce(QString schematic, QString dataset)
int doNgspiceNetlist(QString schematic, QString netlist)
{
QucsSettings.DefaultSimulator = spicecompat::simNgspice;
Module::registerModules();
Schematic *sch = openSchematic(schematic);
if (sch == NULL) {
return 1;
@ -488,6 +490,7 @@ int doNgspiceNetlist(QString schematic, QString netlist)
int doXyceNetlist(QString schematic, QString netlist)
{
QucsSettings.DefaultSimulator = spicecompat::simXyce;
Module::registerModules();
Schematic *sch = openSchematic(schematic);
if (sch == NULL) {
return 1;