Commit ebe1918027251a0e6ed923a04cc5c7f98e11c52e
1 parent
75a7054d
cleaned up Rscript logic, added helpful message on failure
Showing
1 changed file
with
4 additions
and
6 deletions
sdk/core/qtutils.cpp
| @@ -267,14 +267,12 @@ void QtUtils::checkArgsSize(const QString &name, const QStringList &args, int mi | @@ -267,14 +267,12 @@ void QtUtils::checkArgsSize(const QString &name, const QStringList &args, int mi | ||
| 267 | 267 | ||
| 268 | bool QtUtils::runRScript(const QString &file) | 268 | bool QtUtils::runRScript(const QString &file) |
| 269 | { | 269 | { |
| 270 | - QString RScriptExecutable = Globals->sdkPath + "/R/bin/Rscript.exe"; | ||
| 271 | - if (!QFileInfo(RScriptExecutable).exists()) RScriptExecutable = "RScript"; // Let the system resolve it | ||
| 272 | - | ||
| 273 | - QStringList args; args << file; | ||
| 274 | QProcess RScript; | 270 | QProcess RScript; |
| 275 | - RScript.start(RScriptExecutable, args); | 271 | + RScript.start("Rscript", QStringList() << file); |
| 276 | RScript.waitForFinished(-1); | 272 | RScript.waitForFinished(-1); |
| 277 | - return ((RScript.exitCode() == 0) && (RScript.error() == QProcess::UnknownError)); | 273 | + bool result = ((RScript.exitCode() == 0) && (RScript.error() == QProcess::UnknownError)); |
| 274 | + if (!result) qDebug("Failed to run 'Rscript', did you forget to install R? See online documentation of 'br_plot' for required R packages."); | ||
| 275 | + return result; | ||
| 278 | } | 276 | } |
| 279 | 277 | ||
| 280 | bool QtUtils::runDot(const QString &file) | 278 | bool QtUtils::runDot(const QString &file) |