From 314028e95733a3a3cf75798995bb0525d76ab91b Mon Sep 17 00:00:00 2001 From: dsm <41967334+dsm@users.noreply.github.com> Date: Thu, 5 Dec 2024 16:01:10 +0300 Subject: [PATCH] fix path. --- qucs/main.cpp | 8 ++++---- qucs/qucs.cpp | 31 +++++++++++++++++-------------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/qucs/main.cpp b/qucs/main.cpp index 287cd5b83..21f6c4bf4 100644 --- a/qucs/main.cpp +++ b/qucs/main.cpp @@ -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("AdmsXmlBinDir")); diff --git a/qucs/qucs.cpp b/qucs/qucs.cpp index 07d0eb4f4..e8ee08f2b 100644 --- a/qucs/qucs.cpp +++ b/qucs/qucs.cpp @@ -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; @@ -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();