Show error message if output file is not writable (#779)

This commit is contained in:
Maksim Derbasov authored and GitHub committed 2020-06-09 23:54:22 +03:00
1 parent 2ed596c87a
commit 67ebba6f22
1 file changed
+6 -1
+6 -1
View File
@@ -351,7 +351,12 @@ int main(int argc, char *argv[]) {
outputName = getFileNameFromPath(fileNameNoExt(FLAGS_m)) + ".blob";
}
std::ofstream outputFile{outputName};
executableNetwork.Export(outputFile);
if (!outputFile) {
std::cout << "Output file " << outputName << " can't be opened for writing" << std::endl;
return EXIT_FAILURE;
} else {
executableNetwork.Export(outputFile);
}
} catch (const std::exception &error) {
std::cerr << error.what() << std::endl;
return EXIT_FAILURE;