Make failing TestApplication::workingCopyPathMode() more verbose

This commit is contained in:
Martchus 2018-07-28 15:59:31 +02:00
parent 93d6fb5d88
commit c53472fdce
1 changed files with 15 additions and 13 deletions

View File

@ -242,20 +242,22 @@ string TestApplication::workingCopyPathMode(const string &name, WorkingCopyMode
} }
} }
if (mode == WorkingCopyMode::NoCopy) {
return m_workingDir + name;
}
// copy file // copy file
if (mode != WorkingCopyMode::NoCopy) { const auto origFilePath(testFilePath(name));
const auto workingCopyPath(m_workingDir + name);
try { try {
origFile.open(testFilePath(name), ios_base::in | ios_base::binary); origFile.open(origFilePath, ios_base::in | ios_base::binary);
const string path = m_workingDir + name; workingCopy.open(workingCopyPath, ios_base::out | ios_base::binary | ios_base::trunc);
workingCopy.open(path, ios_base::out | ios_base::binary | ios_base::trunc);
workingCopy << origFile.rdbuf(); workingCopy << origFile.rdbuf();
return path; return workingCopyPath;
} catch (...) { } catch (...) {
catchIoFailure(); catchIoFailure();
cerr << Phrases::Error << "Unable to create working copy for \"" << name << "\": an IO error occured." << Phrases::EndFlush; cerr << Phrases::Error << "Unable to create working copy for \"" << name << "\": an IO error occurred when copying \"" << origFilePath
} << "\" to \"" << workingCopyPath << "\"." << Phrases::EndFlush;
} else {
return m_workingDir + name;
} }
return string(); return string();
} }