aboutsummaryrefslogtreecommitdiff
path: root/libLumina/LuminaXDG.cpp
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2015-08-19 09:24:50 -0400
committerKen Moore <moorekou@gmail.com>2015-08-19 09:24:50 -0400
commit462795dbaa135f92c72bb7a37e7a4f9f4f1e1b94 (patch)
tree2be7c708565b51987762d31d74a2ce044d7a80cc /libLumina/LuminaXDG.cpp
parentUpdate the overall lumina project file to support multi-thread builds properly (diff)
downloadlumina-462795dbaa135f92c72bb7a37e7a4f9f4f1e1b94.tar.gz
lumina-462795dbaa135f92c72bb7a37e7a4f9f4f1e1b94.tar.bz2
lumina-462795dbaa135f92c72bb7a37e7a4f9f4f1e1b94.zip
Add the XDG_DATA_* path support for relative application paths given in the mime database.
Diffstat (limited to 'libLumina/LuminaXDG.cpp')
-rw-r--r--libLumina/LuminaXDG.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/libLumina/LuminaXDG.cpp b/libLumina/LuminaXDG.cpp
index d71edf60..473d8620 100644
--- a/libLumina/LuminaXDG.cpp
+++ b/libLumina/LuminaXDG.cpp
@@ -709,6 +709,19 @@ QString LXDG::findDefaultAppForMime(QString mime){
}
//Now check for relative paths to file (in current priority-ordered work dir)
else if( QFile::exists(workdir+"/"+white[w]) ){ cdefault=workdir+"/"+white[w]; break; }
+ //Now go through the XDG DATA dirs and see if the file is in there
+ else{
+ QStringList xdirs;
+ xdirs << QString(getenv("XDG_DATA_HOME"))+"/applications/";
+ tmp = QString(getenv("XDG_DATA_DIRS")).split(":");
+ for(int t=0; t<tmp.length(); t++){ dirs << tmp[t]+"/applications/"; }
+ //Now scan these dirs
+ bool found = false;
+ for(int x=0; x<xdirs.length() && !found; x++){
+ if(QFile::exists(xdirs[x]+white[w])){cdefault=xdirs[x]+white[w]; found = true; }
+ }
+ if(found){ break; }
+ }
}
/* WRITTEN BUT UNUSED CODE FOR MIMETYPE ASSOCIATIONS
//Skip using this because it is simply an alternate/unsupported standard that conflicts with
bgstack15