Mercurial > hg > svcore
diff transform/FileFeatureWriter.cpp @ 626:686fc1703a33
* Avoid failing on second and subsequent input files in single-output-file
mode (because first input file caused output file to be open, so second
input file failed because output "already existed")
author | Chris Cannam |
---|---|
date | Mon, 24 May 2010 16:04:10 +0000 |
parents | 608b4dc5ff34 |
children | cd1fa6387cb9 |
line wrap: on
line diff
--- a/transform/FileFeatureWriter.cpp Fri May 21 10:21:18 2010 +0000 +++ b/transform/FileFeatureWriter.cpp Mon May 24 16:04:10 2010 +0000 @@ -218,7 +218,14 @@ FileFeatureWriter::testOutputFile(QString trackId, TransformId transformId) { - if (m_stdout) return; + // Obviously, if we're writing to stdout we can't test for an + // openable output file. But when writing a single file we don't + // want to either, because this test would fail on the second and + // subsequent input files (because the file would already exist). + // getOutputFile does the right thing in this case, so we just + // leave it to it + if (m_stdout || m_singleFileName != "") return; + QString filename = getOutputFilename(trackId, transformId); if (filename == "") { throw FailedToOpenOutputStream(trackId, transformId); @@ -266,7 +273,7 @@ m_files[key] = 0; throw FailedToOpenFile(filename); } - + m_files[key] = file; } @@ -281,7 +288,7 @@ if (!file && !m_stdout) { return 0; } - + if (m_streams.find(file) == m_streams.end()) { if (m_stdout) { m_streams[file] = new QTextStream(stdout);