Mercurial > hg > svcore
diff data/fileio/FileSource.cpp @ 355:d02f71281639
* Fix #1841095 tapping time instant gives wrong time in aligned track
* Fix #1815654 source tidying: Labeller
* Fix (I hope) #1849999 Time value graphs one instant out
author | Chris Cannam |
---|---|
date | Thu, 13 Dec 2007 17:14:33 +0000 |
parents | 4175a4930186 |
children | b92513201610 |
line wrap: on
line diff
--- a/data/fileio/FileSource.cpp Tue Dec 11 14:58:29 2007 +0000 +++ b/data/fileio/FileSource.cpp Thu Dec 13 17:14:33 2007 +0000 @@ -27,7 +27,7 @@ #include <iostream> -//#define DEBUG_FILE_SOURCE 1 +#define DEBUG_FILE_SOURCE 1 int FileSource::m_count = 0; @@ -200,17 +200,37 @@ FileSource::init(bool showProgress) { if (!isRemote()) { +#ifdef DEBUG_FILE_SOURCE + std::cerr << "FileSource::init: Not a remote URL" << std::endl; +#endif + bool literal = false; 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(); + literal = true; } +#ifdef DEBUG_FILE_SOURCE + std::cerr << "FileSource::init: URL translates to local filename \"" + << m_localFilename.toStdString() << "\"" << std::endl; +#endif m_ok = true; + m_lastStatus = 200; + if (!QFileInfo(m_localFilename).exists()) { - m_lastStatus = 404; - } else { - m_lastStatus = 200; + if (literal) { + m_lastStatus = 404; + } else { + // Again, QUrl may have been mistreating us -- + // e.g. dropping a part that looks like query data + m_localFilename = m_url.toString(); + literal = true; + if (!QFileInfo(m_localFilename).exists()) { + m_lastStatus = 404; + } + } } + m_done = true; return; }