diff options
author | Ken Moore <moorekou@gmail.com> | 2016-08-18 08:55:03 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2016-08-18 08:55:03 -0400 |
commit | 23daab6c5d6d1900318515706fb7063394d36f2b (patch) | |
tree | ed9482c8c693e0468dd24fb9b8ae53a4e93b5cdc /src-qt5/core/lumina-open | |
parent | A couple quick fixes: (diff) | |
download | lumina-23daab6c5d6d1900318515706fb7063394d36f2b.tar.gz lumina-23daab6c5d6d1900318515706fb7063394d36f2b.tar.bz2 lumina-23daab6c5d6d1900318515706fb7063394d36f2b.zip |
Oops: *Now* lumina-open will handle binary names as inputs just fine (if they exist).
Diffstat (limited to 'src-qt5/core/lumina-open')
-rw-r--r-- | src-qt5/core/lumina-open/main.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src-qt5/core/lumina-open/main.cpp b/src-qt5/core/lumina-open/main.cpp index b5f0d97f..cfbfc99b 100644 --- a/src-qt5/core/lumina-open/main.cpp +++ b/src-qt5/core/lumina-open/main.cpp @@ -220,20 +220,25 @@ void getCMD(int argc, char ** argv, QString& binary, QString& args, QString& pat }else{ printUsageInfo(); } + + //Make sure that it is a valid file/URL bool isFile=false; bool isUrl=false; + QString extension; //Quick check/replacement for the URL syntax of a file if(inFile.startsWith("file://")){ inFile.remove(0,7); } + //First make sure this is not a binary name first + QString bin = inFile.section(" ",0,0).simplified(); + if(LUtils::isValidBinary(bin) && !bin.endsWith(".desktop") ){isFile=true; extension="binary"; } //Now check what type of file this is - if(QFile::exists(inFile)){ isFile=true; } + else if(QFile::exists(inFile)){ isFile=true; } else if(QFile::exists(QDir::currentPath()+"/"+inFile)){isFile=true; inFile = QDir::currentPath()+"/"+inFile;} //account for relative paths else if(inFile.startsWith("mailto:")){ isUrl= true; } else if(QUrl(inFile).isValid() && !inFile.startsWith("/") ){ isUrl=true; } if( !isFile && !isUrl ){ ShowErrorDialog( argc, argv, QString(QObject::tr("Invalid file or URL: %1")).arg(inFile) ); } //Determing the type of file (extension) - QString extension; //qDebug() << "File Type:" << isFile << isUrl; - if(isFile){ + if(isFile && extension.isEmpty()){ QFileInfo info(inFile); extension=info.suffix(); //qDebug() << " - Extension:" << extension; |