diff options
Diffstat (limited to 'libLumina')
-rw-r--r-- | libLumina/LuminaUtils.cpp | 6 | ||||
-rw-r--r-- | libLumina/LuminaUtils.h | 6 |
2 files changed, 9 insertions, 3 deletions
diff --git a/libLumina/LuminaUtils.cpp b/libLumina/LuminaUtils.cpp index aa2336e3..6660f65c 100644 --- a/libLumina/LuminaUtils.cpp +++ b/libLumina/LuminaUtils.cpp @@ -87,7 +87,7 @@ bool LUtils::writeFile(QString filepath, QStringList contents, bool overwrite){ return ok; } -bool LUtils::isValidBinary(QString bin){ +bool LUtils::isValidBinary(QString& bin){ if(!bin.startsWith("/")){ //Relative path: search for it on the current "PATH" settings QStringList paths = QString(qgetenv("PATH")).split(":"); @@ -98,7 +98,9 @@ bool LUtils::isValidBinary(QString bin){ //bin should be the full path by now if(!bin.startsWith("/")){ return false; } QFileInfo info(bin); - return (info.exists() && info.isExecutable()); + bool good = (info.exists() && info.isExecutable()); + if(good){ bin = info.absoluteFilePath(); } + return good; } QStringList LUtils::listSubDirectories(QString dir, bool recursive){ diff --git a/libLumina/LuminaUtils.h b/libLumina/LuminaUtils.h index 960e6080..74a72465 100644 --- a/libLumina/LuminaUtils.h +++ b/libLumina/LuminaUtils.h @@ -36,7 +36,11 @@ public: static bool writeFile(QString filepath, QStringList contents, bool overwrite=false); //Check whether a file/path is a valid binary - static bool isValidBinary(QString bin); //full path or name only + static bool isValidBinary(QString& bin); //full path or name only + static bool isValidBinary(const char *bin){ + QString bins(bin); + return isValidBinary(bins); //overload for a "junk" binary variable input + } //List all the sub-directories of a parent dir (recursive) static QStringList listSubDirectories(QString dir, bool recursive = true); |