changeset 661:a4faa1840384

* If a FileSource URL won't convert at all in strict mode, try again in tolerant mode (necessary for e.g. filenames with square brackets in them)
author Chris Cannam
date Tue, 19 Oct 2010 21:47:55 +0100 (2010-10-19)
parents 5db8181ea521
children badbbf0921fa
files data/fileio/FileSource.cpp
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/data/fileio/FileSource.cpp	Mon Oct 18 14:17:02 2010 +0100
+++ b/data/fileio/FileSource.cpp	Tue Oct 19 21:47:55 2010 +0100
@@ -83,8 +83,12 @@
     m_reporter(reporter),
     m_refCounted(false)
 {
+    if (m_url.toString() == "") {
+        m_url = QUrl(fileOrUrl, QUrl::TolerantMode);
+    }
+ 
 #ifdef DEBUG_FILE_SOURCE
-    std::cerr << "FileSource::FileSource(" << fileOrUrl.toStdString() << ")" << std::endl;
+    std::cerr << "FileSource::FileSource(" << fileOrUrl.toStdString() << "): url <" << m_url.toString().toStdString() << ">" << std::endl;
     incCount(m_url.toString());
 #endif
 
@@ -266,7 +270,7 @@
 
 #ifdef DEBUG_FILE_SOURCE
         std::cerr << "FileSource::init: URL translates to local filename \""
-                  << m_localFilename.toStdString() << "\"" << std::endl;
+                  << m_localFilename.toStdString() << "\" (with literal=" << literal << ")" << std::endl;
 #endif
         m_ok = true;
         m_lastStatus = 200;