Skip to content

Commit

Permalink
fix path.
Browse files Browse the repository at this point in the history
  • Loading branch information
dsm committed Dec 5, 2024
1 parent c94049b commit 314028e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
8 changes: 4 additions & 4 deletions qucs/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,16 @@ bool loadSettings()

// TODO: Convert this to the new settings model.
if(settings.contains("Qucsator")) {
QucsSettings.Qucsator = settings.value("Qucsator").toString();
QucsSettings.Qucsator = QDir::toNativeSeparators(settings.value("Qucsator").toString());
QFileInfo inf(QucsSettings.Qucsator);
QucsSettings.QucsatorDir = inf.canonicalPath() + QDir::separator();
if (QucsSettings.Qucsconv.isEmpty())
QucsSettings.Qucsconv = QucsSettings.QucsatorDir + QDir::separator() + "qucsconv_rf" + executableSuffix;
QucsSettings.Qucsconv = QDir::toNativeSeparators(QucsSettings.QucsatorDir + "qucsconv_rf" + executableSuffix);
} else {
QucsSettings.Qucsator = QucsSettings.BinDir + "qucsator_rf" + executableSuffix;
QucsSettings.Qucsator = QDir::toNativeSeparators(QucsSettings.BinDir + "qucsator_rf" + executableSuffix);
QucsSettings.QucsatorDir = QucsSettings.BinDir;
if (QucsSettings.Qucsconv.isEmpty())
QucsSettings.Qucsconv = QucsSettings.BinDir + "qucsconv_rf" + executableSuffix;
QucsSettings.Qucsconv = QDir::toNativeSeparators(QucsSettings.BinDir + "qucsconv_rf" + executableSuffix);
}

QucsSettings.AdmsXmlBinDir.setPath(_settings::Get().item<QString>("AdmsXmlBinDir"));
Expand Down
31 changes: 17 additions & 14 deletions qucs/qucs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,31 +174,32 @@ QucsApp::QucsApp()

if (QucsSettings.firstRun) { // try to find Ngspice
#ifdef Q_OS_WIN
QString ngspice_exe1 = QucsSettings.BinDir + QDir::separator() + "ngspice_con.exe";
QString ngspice_exe2 = "C:\\Spice64\\bin\\ngspice_con.exe";
QString qucsator_exe = QucsSettings.BinDir + QDir::separator() + "qucsator_rf.exe";
QString ngspice_exe1 = QDir::toNativeSeparators(QucsSettings.BinDir + "ngspice_con.exe");
QString ngspice_exe2 = QDir::toNativeSeparators("C:/Spice64/bin/ngspice_con.exe");
QString qucsator_exe = QDir::toNativeSeparators(QucsSettings.BinDir + "qucsator_rf.exe");
#else
QString ngspice_exe1 = QucsSettings.BinDir + QDir::separator() + "ngspice";
QString qucsator_exe = QucsSettings.BinDir + QDir::separator() + "qucsator_rf";
QString ngspice_exe1 = QDir::toNativeSeparators(QucsSettings.BinDir + "ngspice");
QString ngspice_exe2 = "/usr/bin/ngspice"; /* added for appimage don't find first time */
QString qucsator_exe = QDir::toNativeSeparators(QucsSettings.BinDir + "qucsator_rf");
#endif

QString ngspice_exe;
bool ngspice_found = false;

if (QFile::exists(ngspice_exe1)) {
ngspice_found = true;
ngspice_exe = ngspice_exe1;
}else if(QFile::exists(ngspice_exe2)){
ngspice_found = true;
ngspice_exe = ngspice_exe2;
}

bool qucsator_found = false;
if (QFile::exists(qucsator_exe)) {
qucsator_found = true;
QucsSettings.Qucsator = qucsator_exe;
}
#ifdef Q_OS_WIN
if (!ngspice_found && QFile::exists(ngspice_exe2)) {
ngspice_found = true;
ngspice_exe = ngspice_exe2;
}
#endif
ngspice_exe = QDir::toNativeSeparators(ngspice_exe);

QString info_string;
if (ngspice_found) {
QucsSettings.DefaultSimulator = spicecompat::simNgspice;
Expand Down Expand Up @@ -226,12 +227,14 @@ QucsApp::QucsApp()
}
QucsSettings.firstRun = false;
} else if (!QFile::exists(QucsSettings.Qucsator)) {
QucsSettings.Qucsator = QucsSettings.BinDir + QDir::separator() + "qucsator_rf";
QucsSettings.Qucsator = QDir::toNativeSeparators(QucsSettings.BinDir + "qucsator_rf");
#ifdef Q_OS_WIN
QucsSettings.Qucsator += ".exe";
#endif
QMessageBox::information(this, "Qucs",
if(QFile::exists(QucsSettings.Qucsator)){
QMessageBox::information(this, "Qucs",
tr("QucsatorRF found at: ") + QucsSettings.Qucsator + "\n");
}
}

// fillLibrariesTreeView();
Expand Down

0 comments on commit 314028e

Please sign in to comment.