comparison transform/FileFeatureWriter.cpp @ 615:521438145bd7

More changes related to strict/tolerant URL parsing: * when selecting an output file name for a given input filename: - parse the url in StrictMode; - also, use completeBaseName() rather than baseName() * when writing out a file:/// URL to the audio: - parse the url in StrictMode.
author Christophe Rhodes
date Wed, 07 Oct 2009 16:45:45 +0000
parents 4541581067f3
children 608b4dc5ff34
comparison
equal deleted inserted replaced
614:87b81f959706 615:521438145bd7
165 return m_singleFileName; 165 return m_singleFileName;
166 } 166 }
167 167
168 if (m_stdout) return ""; 168 if (m_stdout) return "";
169 169
170 QUrl url(trackId); 170 QUrl url(trackId, QUrl::StrictMode);
171 QString scheme = url.scheme().toLower(); 171 QString scheme = url.scheme().toLower();
172 bool local = (scheme == "" || scheme == "file" || scheme.length() == 1); 172 bool local = (scheme == "" || scheme == "file" || scheme.length() == 1);
173 173
174 QString dirname, basename; 174 QString dirname, basename;
175 QString infilename = url.toLocalFile(); 175 QString infilename = url.toLocalFile();
176 if (infilename == "") { 176 if (infilename == "") {
177 infilename = url.path(); 177 infilename = url.path();
178 } 178 }
179 basename = QFileInfo(infilename).baseName(); 179 basename = QFileInfo(infilename).completeBaseName();
180 if (scheme.length() == 1) { 180 if (scheme.length() == 1) {
181 infilename = scheme + ":" + infilename; // DOS drive! 181 infilename = scheme + ":" + infilename; // DOS drive!
182 } 182 }
183 183
184 cerr << "trackId = " << trackId.toStdString() << ", url = " << url.toString().toStdString() << ", infilename = " 184 cerr << "trackId = " << trackId.toStdString() << ", url = " << url.toString().toStdString() << ", infilename = "