bool IddFile::save(const openstudio::path& p, bool overwrite) { path wp = completePathToFile(p,path(),"idd",true); if (!wp.empty() && (overwrite == false)) { LOG(Info,"IddFile save method failed because instructed not to overwrite path '" << toString(p) << "'."); return false; } if (makeParentFolder(p)) { boost::filesystem::ofstream outFile(p); if (outFile) { try { print(outFile); outFile.close(); return true; } catch (...) { LOG(Error,"Unable to write IddFile to path '" << toString(p) << "'."); return false; } } } LOG(Error,"Unable to write IddFile to path '" << toString(p) << "', because parent directory could not be created."); return false; }
bool WorkflowJSON_Impl::save() const { boost::optional<openstudio::path> p = oswPath(); if (!p){ return false; } if (makeParentFolder(*p)) { std::ofstream outFile(openstudio::toString(*p)); if (outFile) { try { outFile << string(); outFile.close(); return true; } catch (...) { LOG(Error, "Unable to write file to path '" << toString(*p) << "'."); return false; } } } LOG(Error, "Unable to write file to path '" << toString(*p) << "', because parent directory " << "could not be created."); return false; }