| 310 | } |
| 311 | |
| 312 | bool saveModelTempDir(const openstudio::path& modelTempDir, const openstudio::path& osmPath) { |
| 313 | bool test = true; |
| 314 | |
| 315 | // copy osm file |
| 316 | openstudio::path srcPath = modelTempDir / osmPath.filename(); |
| 317 | |
| 318 | try { |
| 319 | openstudio::filesystem::copy_file(srcPath, osmPath, openstudio::filesystem::copy_options::overwrite_existing); |
| 320 | test = true; |
| 321 | } catch (const std::exception& e) { |
| 322 | LOG_FREE(Error, "saveModelTempDir", "Could not copy osm from '" << toString(srcPath) << "' to '" << toString(osmPath) << "' error" << e.what()); |
| 323 | test = false; |
| 324 | } |
| 325 | |
| 326 | if (openstudio::filesystem::is_regular_file(osmPath)) { |
| 327 | // copy resources |
| 328 | openstudio::path srcDir = modelTempDir / toPath("resources"); |
| 329 | // Get the companion directory |
| 330 | openstudio::path dstDir = getCompanionFolder(osmPath); |
| 331 | |
| 332 | LOG_FREE(Debug, "saveModelTempDir", "Copying " << toString(srcDir) << " to " << toString(dstDir)); |
| 333 | |
| 334 | test = replaceDir(srcDir, dstDir); |
| 335 | if (!test) { |
| 336 | LOG_FREE(Error, "saveModelTempDir", "Could not copy '" << toString(srcDir) << "' to '" << toString(dstDir) << "'"); |
| 337 | } |
| 338 | } |
| 339 | |
| 340 | return test; |
| 341 | } |
| 342 | |
| 343 | bool saveModel(openstudio::model::Model model, const openstudio::path& osmPath, const openstudio::path& modelTempDir) { |
| 344 | // set the workflow's path |
no test coverage detected