MCPcopy Create free account
hub / github.com/chigraph/chigraph / listModulesInWorkspace

Method listModulesInWorkspace

libchigraph/src/Context.cpp:70–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70std::vector<std::string> Context::listModulesInWorkspace() const noexcept {
71 std::vector<std::string> moduleList;
72
73 fs::path srcDir = workspacePath() / "src";
74
75 if (!fs::is_directory(srcDir)) { return {}; }
76
77 for (const auto& dirEntry : boost::make_iterator_range(
78 fs::recursive_directory_iterator{srcDir, fs::symlink_option::recurse}, {})) {
79 const fs::path& p = dirEntry;
80
81 // see if it's a chigraph module
82 if (fs::is_regular_file(p) && p.extension() == ".chimod") {
83 fs::path relPath = fs::relative(p, srcDir);
84
85 relPath.replace_extension(""); // remove .chimod
86 moduleList.emplace_back(relPath.string());
87 }
88 }
89
90 return moduleList;
91}
92
93Result Context::loadModule(const fs::path& name, Flags<LoadSettings> settings, ChiModule** toFill) {
94 assert(!name.empty() && "Name should not be empty when calling chi::Context::loadModule");

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected