Mercurial > hg > svcore
diff data/fileio/FileSource.cpp @ 342:4175a4930186
* Fixes for handling of DOS paths (C:\blah) -- not an unknown URL scheme!
author | Chris Cannam |
---|---|
date | Mon, 26 Nov 2007 15:05:51 +0000 |
parents | 5cd7f6d10d47 |
children | d02f71281639 94fc0591ea43 |
line wrap: on
line diff
--- a/data/fileio/FileSource.cpp Mon Nov 26 13:33:14 2007 +0000 +++ b/data/fileio/FileSource.cpp Mon Nov 26 15:05:51 2007 +0000 @@ -201,6 +201,10 @@ { if (!isRemote()) { m_localFilename = m_url.toLocalFile(); + if (m_localFilename == "") { + // QUrl may have mishandled the scheme (e.g. in a DOS path) + m_localFilename = m_url.toString(); + } m_ok = true; if (!QFileInfo(m_localFilename).exists()) { m_lastStatus = 404; @@ -403,16 +407,19 @@ bool FileSource::isRemote(QString fileOrUrl) { + // Note that a "scheme" with length 1 is probably a DOS drive letter QString scheme = QUrl(fileOrUrl).scheme().toLower(); - return (scheme == "http" || scheme == "ftp"); + if (scheme == "" || scheme == "file" || scheme.length() == 1) return false; + return true; } bool FileSource::canHandleScheme(QUrl url) { + // Note that a "scheme" with length 1 is probably a DOS drive letter QString scheme = url.scheme().toLower(); return (scheme == "http" || scheme == "ftp" || - scheme == "file" || scheme == ""); + scheme == "file" || scheme == "" || scheme.length() == 1); } bool