| 667 | } |
| 668 | |
| 669 | Result GraphModule::saveToDisk() const { |
| 670 | Result res; |
| 671 | |
| 672 | // can't serialize without a workspace... |
| 673 | if (!context().hasWorkspace()) { |
| 674 | res.addEntry("EUKN", "Cannot serialize without a worksapce", {}); |
| 675 | return res; |
| 676 | } |
| 677 | |
| 678 | auto modulePath = sourceFilePath(); |
| 679 | |
| 680 | try { |
| 681 | // create directories that conatain the path |
| 682 | fs::create_directories(modulePath.parent_path()); |
| 683 | |
| 684 | } catch (std::exception& e) { |
| 685 | res.addEntry("EUKN", "Failed to create directoires in workspace", |
| 686 | {{"Module File", modulePath.string()}}); |
| 687 | return res; |
| 688 | } |
| 689 | |
| 690 | // serialize |
| 691 | nlohmann::json toFill = graphModuleToJson(*this); |
| 692 | |
| 693 | // save |
| 694 | fs::ofstream ostr(modulePath); |
| 695 | ostr << toFill.dump(2); |
| 696 | |
| 697 | return res; |
| 698 | } |
| 699 | |
| 700 | GraphFunction* GraphModule::getOrCreateFunction(std::string name, |
| 701 | std::vector<NamedDataType> dataIns, |
nothing calls this directly
no test coverage detected