Mipgen now creates the out dir if needed.

This commit is contained in:
Philip Rideout
2018-11-30 09:23:22 -08:00
parent 533e260804
commit 5abd60fca5

View File

@@ -338,6 +338,7 @@ int main(int argc, char* argv[]) {
}
vector<uint8_t> fileContents(container.getSerializedLength());
container.serialize(fileContents.data(), fileContents.size());
Path(outputPattern).getParent().mkdirRecursive();
ofstream outputStream(outputPattern, ios::out | ios::binary);
outputStream.write((const char*) fileContents.data(), fileContents.size());
outputStream.close();
@@ -354,6 +355,7 @@ int main(int argc, char* argv[]) {
cerr << "Output pattern is too long." << endl;
return 1;
}
Path(path).getParent().mkdirRecursive();
ofstream outputStream(path, ios::binary | ios::trunc);
if (!outputStream) {
cerr << "The output file cannot be opened: " << path << endl;