# HG changeset patch # User Chris Cannam # Date 1274717050 0 # Node ID 686fc1703a33c58ee867fdd6310cdbfbd7ff3307 # Parent 608b4dc5ff34ea8654c70ccf268942ee3be5ebf0 * 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") diff -r 608b4dc5ff34 -r 686fc1703a33 transform/FileFeatureWriter.cpp --- 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);