From 0249c04c50ece0177c899f180cb6067c921039f2 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Fri, 16 Dec 2016 10:09:33 -0500 Subject: Fix the mimetype matching routine to support multiple-extension formats better (*.tar.gz as opposed to *.gz) --- src-qt5/core/libLumina/LuminaXDG.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src-qt5/core/libLumina') diff --git a/src-qt5/core/libLumina/LuminaXDG.cpp b/src-qt5/core/libLumina/LuminaXDG.cpp index d6342269..b01eaccb 100644 --- a/src-qt5/core/libLumina/LuminaXDG.cpp +++ b/src-qt5/core/libLumina/LuminaXDG.cpp @@ -868,16 +868,18 @@ QIcon LXDG::findMimeIcon(QString extension){ QString LXDG::findAppMimeForFile(QString filename, bool multiple){ QString out; - QString extension = filename.section(".",-1); + QString extension = filename.section(".",1,-1); if("."+extension == filename){ extension.clear(); } //hidden file without extension //qDebug() << "MIME SEARCH:" << filename << extension; QStringList mimefull = LXDG::loadMimeFileGlobs2(); QStringList mimes; - //Just in case the extension/filename is a mimetype itself + //Just in case the filename is a mimetype itself if( mimefull.filter(":"+filename+":").length() == 1){ return filename; } - else if(mimefull.filter(":"+extension+":").length() == 1){ +while(mimes.isEmpty()){ + //Check for an exact mimetype match + if(mimefull.filter(":"+extension+":").length() == 1){ return extension; } //Look for globs at the end of the filename @@ -898,7 +900,12 @@ QString LXDG::findAppMimeForFile(QString filename, bool multiple){ for(int i=0; i