diff --git a/src/on2json/on2json.cpp b/src/on2json/on2json.cpp index 46c93a7..7a5669a 100644 --- a/src/on2json/on2json.cpp +++ b/src/on2json/on2json.cpp @@ -154,17 +154,17 @@ std::string on2json_run(std::string &fileName, Config &cfg) fnameSave = fileName.substr(0, fileName.find_last_of(".")) + ".json"; std::ofstream fileSave(fnameSave.c_str(), std::ios::out); if (!fileSave) - { - // Save JSON string to the file - fileSave << jsonString << std::endl; - fileSave.close(); - } - else { if (!cfg.silent()) std::cout << "[ERROR] Cannot open file '" << fnameSave << "' for writing!" << std::endl; fnameSave.clear(); } + else + { + // Save JSON string to the file + fileSave << jsonString << std::endl; + fileSave.close(); + } } return fnameSave;