MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / saveModelTempDir

Function saveModelTempDir

src/model/FileOperations.cpp:312–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

saveModelFunction · 0.85

Calls 5

getCompanionFolderFunction · 0.85
replaceDirFunction · 0.85
filenameMethod · 0.80
toStringFunction · 0.50
toPathFunction · 0.50

Tested by

no test coverage detected