aboutsummaryrefslogtreecommitdiff
path: root/libLumina
diff options
context:
space:
mode:
authorKen Moore <ken@pcbsd.org>2015-05-25 09:30:43 -0400
committerKen Moore <ken@pcbsd.org>2015-05-25 09:30:43 -0400
commit172b7e4565384da84ad3e572caf47596c36ad9f1 (patch)
tree121436130d5c671c55d31ea38c8a869e179e5d99 /libLumina
parentMove the desktop initialization after the menu's initialization. With all teh... (diff)
downloadlumina-172b7e4565384da84ad3e572caf47596c36ad9f1.tar.gz
lumina-172b7e4565384da84ad3e572caf47596c36ad9f1.tar.bz2
lumina-172b7e4565384da84ad3e572caf47596c36ad9f1.zip
Add the ability to show binaries on the lumina-search output as well as *.desktop files.
Diffstat (limited to 'libLumina')
-rw-r--r--libLumina/LuminaUtils.cpp6
-rw-r--r--libLumina/LuminaUtils.h6
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);
bgstack15