[education/rkward] rkward: Avoid misleading message, if no R installation was found (importantly, for the Mac bundle)

Thomas Friedrichsmeier null at kde.org
Sat Jun 29 14:14:03 BST 2024


Git commit 73926c27dd7555693f571697d6c93e4e281f5717 by Thomas Friedrichsmeier.
Committed on 29/06/2024 at 13:13.
Pushed by tfry into branch 'master'.

Avoid misleading message, if no R installation was found (importantly, for the Mac bundle)

M  +9    -3    rkward/dialogs/rksetupwizard.cpp
M  +4    -2    rkward/rbackend/rkfrontendtransmitter.cpp

https://invent.kde.org/education/rkward/-/commit/73926c27dd7555693f571697d6c93e4e281f5717

diff --git a/rkward/dialogs/rksetupwizard.cpp b/rkward/dialogs/rksetupwizard.cpp
index 5effd7597..966850387 100644
--- a/rkward/dialogs/rksetupwizard.cpp
+++ b/rkward/dialogs/rksetupwizard.cpp
@@ -125,7 +125,11 @@ public:
 		update();
 	}
 	void update() {
-		rinst_label->setText(i18n("RKWard is currently using the R installation at <nobr>%1</nobr>.", RKSessionVars::RBinary()));
+		if (RKSessionVars::RBinary().isEmpty()) {
+			rinst_label->setText(i18n("RKWard <b>failed to detect an R installation</b> on this system"));
+		} else {
+			rinst_label->setText(i18n("RKWard is currently using the R installation at <nobr>%1</nobr>.", RKSessionVars::RBinary()));
+		}
 		detail_button->hide();
 		if (RInterface::instance()->backendIsDead()) {
 			rstatus_icon->setPixmap(iconForStatus(RKSetupWizardItem::Error));
@@ -194,8 +198,10 @@ public:
 		}
 
 		r_installations = RKSessionVars::findRInstallations();
-		r_installations.removeAll(RKSessionVars::RBinary());
-		r_installations.prepend(RKSessionVars::RBinary());
+		if (!RKSessionVars::RBinary().isEmpty()) {
+			r_installations.removeAll(RKSessionVars::RBinary());
+			r_installations.prepend(RKSessionVars::RBinary());
+		}
 		for(int i = 0; i < r_installations.size(); ++i) {
 			addButton(i18n("Use R at %1", r_installations[i]), i);
 		}
diff --git a/rkward/rbackend/rkfrontendtransmitter.cpp b/rkward/rbackend/rkfrontendtransmitter.cpp
index dc3da381b..13cb721fd 100644
--- a/rkward/rbackend/rkfrontendtransmitter.cpp
+++ b/rkward/rbackend/rkfrontendtransmitter.cpp
@@ -154,8 +154,10 @@ void RKFrontendTransmitter::detectAndCheckRBinary() {
 			}
 			RK_DEBUG(APP, DL_DEBUG, "Using R as configured in config file %s", qPrintable (rkward_ini_file.absoluteFilePath ()));
 		} else {
-			RK_DEBUG(APP, DL_DEBUG, "Using R as configured at compile time");
-			r_exe = R_EXECUTABLE;
+			if (QFileInfo::exists(R_EXECUTABLE)) {
+				RK_DEBUG(APP, DL_DEBUG, "Using R as configured at compile time");
+				r_exe = R_EXECUTABLE;
+			}
 		}
 	}
 	if (r_exe.isEmpty()) {


More information about the rkward-tracker mailing list