diff data/fileio/FileFinder.cpp @ 384:6f6ab834449d spectrogram-cache-rejig

* Merge from trunk
author Chris Cannam
date Wed, 27 Feb 2008 11:59:42 +0000
parents c324d410b096
children
line wrap: on
line diff
--- a/data/fileio/FileFinder.cpp	Thu Nov 15 14:03:56 2007 +0000
+++ b/data/fileio/FileFinder.cpp	Wed Feb 27 11:59:42 2008 +0000
@@ -378,15 +378,15 @@
 QString
 FileFinder::find(FileType type, QString location, QString lastKnownLocation)
 {
-    if (QFileInfo(location).exists()) return location;
-
-    if (FileSource::isRemote(location)) {
+    if (FileSource::canHandleScheme(location)) {
         if (FileSource(location).isAvailable()) {
             std::cerr << "FileFinder::find: ok, it's available... returning" << std::endl;
             return location;
         }
     }
 
+    if (QFileInfo(location).exists()) return location;
+
     QString foundAt = "";
 
     if ((foundAt = findRelative(location, lastKnownLocation)) != "") {
@@ -415,6 +415,9 @@
         fileName = QUrl(location).path().section('/', -1, -1,
                                                  QString::SectionSkipEmpty);
     } else {
+        if (QUrl(location).scheme() == "file") {
+            location = QUrl(location).toLocalFile();
+        }
         fileName = QFileInfo(location).fileName();
     }
 
@@ -423,6 +426,9 @@
         if (!FileSource(resolved).isAvailable()) resolved = "";
         std::cerr << "resolved: " << resolved.toStdString() << std::endl;
     } else {
+        if (QUrl(relativeTo).scheme() == "file") {
+            relativeTo = QUrl(relativeTo).toLocalFile();
+        }
         resolved = QFileInfo(relativeTo).dir().filePath(fileName);
         if (!QFileInfo(resolved).exists() ||
             !QFileInfo(resolved).isFile() ||