aboutsummaryrefslogtreecommitdiff
path: root/lumina-open/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lumina-open/main.cpp')
-rw-r--r--lumina-open/main.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lumina-open/main.cpp b/lumina-open/main.cpp
index 2b042f61..eb0cb92c 100644
--- a/lumina-open/main.cpp
+++ b/lumina-open/main.cpp
@@ -199,9 +199,11 @@ void getCMD(int argc, char ** argv, QString& binary, QString& args, QString& pat
}
//Make sure that it is a valid file/URL
bool isFile=false; bool isUrl=false;
+ //Quick check/replacement for the URL syntax of a file
+ if(inFile.startsWith("file://")){ inFile.remove(0,7); }
+ //Now check what type of file this is
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(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;
@@ -282,12 +284,13 @@ void getCMD(int argc, char ** argv, QString& binary, QString& args, QString& pat
if( (cmd.contains("%f") || cmd.contains("%F") ) ){
//Apply any special field replacements for the desired format
inFile.replace("%20"," ");
+ if(inFile.startsWith("file://")){ inFile.remove(0,7); } //chop that URL prefix off the front (should have happened earlier - just make sure)
//Now replace the field codes
cmd.replace("%f","\""+inFile+"\"");
cmd.replace("%F","\""+inFile+"\"");
}else if( (cmd.contains("%U") || cmd.contains("%u")) ){
//Apply any special field replacements for the desired format
- if(!inFile.contains("://")){ inFile.prepend("file:"); } //local file - add the extra flag
+ if(!inFile.contains("://")){ inFile.prepend("file://"); } //local file - add the extra flag
inFile.replace(" ", "%20");
//Now replace the field codes
cmd.replace("%u","\""+inFile+"\"");
bgstack15