diff data/fileio/FileSource.cpp @ 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
parents 3a61a4df6d53
children 948271d124ac
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;