From e511e0d897a77f0c7cb55b4629038f07428af0ef Mon Sep 17 00:00:00 2001 From: liuyu Date: Fri, 13 Nov 2020 17:30:08 +0800 Subject: [PATCH] check outputFilePath for windows --- mindspore/lite/tools/converter/converter_flags.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mindspore/lite/tools/converter/converter_flags.cc b/mindspore/lite/tools/converter/converter_flags.cc index ab7a44d54a..92b37e7273 100644 --- a/mindspore/lite/tools/converter/converter_flags.cc +++ b/mindspore/lite/tools/converter/converter_flags.cc @@ -74,15 +74,16 @@ int Flags::Init(int argc, const char **argv) { return RET_INPUT_PARAM_INVALID; } - if (this->outputFile.rfind('/') == this->outputFile.length() - 1) { - std::cerr << "INPUT ILLEGAL: outputFile must be a valid file path"; - return RET_INPUT_PARAM_INVALID; - } - #ifdef _WIN32 replace(this->outputFile.begin(), this->outputFile.end(), '/', '\\'); #endif + if (this->outputFile.rfind('/') == this->outputFile.length() - 1 || + this->outputFile.rfind('\\') == this->outputFile.length() - 1) { + std::cerr << "INPUT ILLEGAL: outputFile must be a valid file path"; + return RET_INPUT_PARAM_INVALID; + } + if (this->fmkIn.empty()) { std::cerr << "INPUT MISSING: fmk is necessary"; return RET_INPUT_PARAM_INVALID;