Actually check if a file exists to know if it's local or not (therefore set the scheme to "file" therefore interpret it correctly in SongLoader)

URLs with ":" were sometimes wrongly interpreted as remote URLs. But some local files may have ":", and moreover on Windows all files have ":" because of the drive letter scheme.
This commit is contained in:
Arnaud Bienner 2012-09-17 20:47:57 +02:00
parent 49e3400545
commit f51ac3f970

View File

@ -220,10 +220,11 @@ bool CommandlineOptions::Parse() {
// Get any filenames or URLs following the arguments
for (int i=optind ; i<argc_ ; ++i) {
QString value = QFile::decodeName(argv_[i]);
if (value.contains(":"))
urls_ << value;
QFileInfo file_info(value);
if (file_info.exists())
urls_ << QUrl::fromLocalFile(file_info.canonicalFilePath());
else
urls_ << QUrl::fromLocalFile(QFileInfo(value).canonicalFilePath());
urls_ << value;
}
return true;