diff options
author | Simon Rettberg | 2019-07-09 11:33:27 +0200 |
---|---|---|
committer | Simon Rettberg | 2019-07-09 11:33:27 +0200 |
commit | 947133905679e19196663bd9923fd063ae4d5b85 (patch) | |
tree | 4edc66c64853ce58fbab49e85c547e4e0dea5070 /src/xsession.cpp | |
parent | vsession.*: Use QStringLiteral for most C-Strings (diff) | |
download | vmchooser2-947133905679e19196663bd9923fd063ae4d5b85.tar.gz vmchooser2-947133905679e19196663bd9923fd063ae4d5b85.tar.xz vmchooser2-947133905679e19196663bd9923fd063ae4d5b85.zip |
Gray out and warn about VMs with missing hypervisor
Diffstat (limited to 'src/xsession.cpp')
-rw-r--r-- | src/xsession.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/xsession.cpp b/src/xsession.cpp index 8e26b86..d2e8cfe 100644 --- a/src/xsession.cpp +++ b/src/xsession.cpp @@ -3,6 +3,7 @@ #include <QLocale> #include <QApplication> #include <QProcess> +#include <QStandardPaths> #include "xsession.h" #include "globals.h" @@ -111,9 +112,17 @@ bool XSession::isActive() const { return true; } -bool XSession::isValid() const { - QFileInfo fi(this->exec_); - return !fi.isAbsolute() || (fi.isFile() && fi.isExecutable()); +QString XSession::checkCanRunInternal() const { + QString exe = this->exec_.left(this->exec_.indexOf(' ')); // -1 means entire string + QFileInfo fi(exe); + if (!fi.isAbsolute()) { + if (!QStandardPaths::findExecutable(exe).isEmpty()) + return QString(); + } + if (fi.isFile() && fi.isExecutable()) + return QString(); + // Not found + return QObject::trUtf8("Binary %1 not found.").arg(exe); } bool XSession::isLocked() const { |