From a81515cb95e973195214e642427966a30bbe4807 Mon Sep 17 00:00:00 2001 From: Andreas Suter Date: Sat, 11 Jul 2020 19:55:11 +0200 Subject: [PATCH 1/2] add another startup check which makes sure that musrfit is found by musredit. --- src/musredit_qt5/musredit/PAdmin.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/musredit_qt5/musredit/PAdmin.cpp b/src/musredit_qt5/musredit/PAdmin.cpp index 47b6cf49..99182870 100644 --- a/src/musredit_qt5/musredit/PAdmin.cpp +++ b/src/musredit_qt5/musredit/PAdmin.cpp @@ -773,6 +773,16 @@ PAdmin::PAdmin() : QObject() fPrefPathName = pathFln; loadPrefs(fPrefPathName); + + // make sure that musrfit, musrview, etc are found under the fExecPath provided + QString str = fExecPath + "/musrfit"; + QFileInfo info(str); + if (info.exists()) { + if (!info.isExecutable()) + QMessageBox::critical(0, "ERROR", "musrfit found but not recognized as executable.\nPlease check!"); + } else { + QMessageBox::critical(0, "ERROR", "musrfit not found.\nHave you set the necessary system variables properly?\nPlease check the manual.\nBefore you can use musrfit, this needs to be fixed."); + } } //-------------------------------------------------------------------------- From be8689853bcc1978306911b25c445352957de24a Mon Sep 17 00:00:00 2001 From: Andreas Suter Date: Sun, 12 Jul 2020 11:24:57 +0200 Subject: [PATCH 2/2] musredit: check if system variables ROOTSYS and MUSRFITPATH are set, and if not popup a warning. --- src/musredit_qt5/musredit/PAdmin.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/musredit_qt5/musredit/PAdmin.cpp b/src/musredit_qt5/musredit/PAdmin.cpp index 99182870..82b8399e 100644 --- a/src/musredit_qt5/musredit/PAdmin.cpp +++ b/src/musredit_qt5/musredit/PAdmin.cpp @@ -783,6 +783,24 @@ PAdmin::PAdmin() : QObject() } else { QMessageBox::critical(0, "ERROR", "musrfit not found.\nHave you set the necessary system variables properly?\nPlease check the manual.\nBefore you can use musrfit, this needs to be fixed."); } + + // check if system variables are set properly + bool sysVarMissing = false; + QString msg("Missing System Variables:\n"); + path = procEnv.value("ROOTSYS", ""); + if (path.isEmpty()) { + msg += "> ROOTSYS\n"; + sysVarMissing = true; + } + path = procEnv.value("MUSRFITPATH", ""); + if (path.isEmpty()) { + msg += "> MUSRFITPATH\n"; + sysVarMissing = true; + } + if (sysVarMissing) { + msg += "Please set this/these system variables."; + QMessageBox::warning(0, "WARNING", msg); + } } //--------------------------------------------------------------------------