From 67ebba6f2287c40b635b7eef29f198084afcf76e Mon Sep 17 00:00:00 2001 From: Maksim Derbasov Date: Tue, 9 Jun 2020 23:54:22 +0300 Subject: [PATCH] Show error message if output file is not writable (#779) --- inference-engine/tools/compile_tool/main.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/inference-engine/tools/compile_tool/main.cpp b/inference-engine/tools/compile_tool/main.cpp index 4552f256271..12bf644502f 100644 --- a/inference-engine/tools/compile_tool/main.cpp +++ b/inference-engine/tools/compile_tool/main.cpp @@ -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;