# HG changeset patch # User Chris Cannam # Date 1196356253 0 # Node ID a9ccd644f3bf528d24aac1a1bf55343b203882f9 # Parent 700cd33503917323cbb4d7e35afbf6e4103f8d57 * Attempt to fix finding of file:/// URLs * Fix incorrect reassignment of source model in layers that had no source model previously, when replacing a null main model diff -r 700cd3350391 -r a9ccd644f3bf data/fileio/FileFinder.cpp --- a/data/fileio/FileFinder.cpp Wed Nov 28 17:45:37 2007 +0000 +++ b/data/fileio/FileFinder.cpp Thu Nov 29 17:10:53 2007 +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() ||