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

Method addSearchPath

src/model/PythonPluginSearchPaths.cpp:89–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87 }
88
89 bool PythonPluginSearchPaths_Impl::addSearchPath(const openstudio::path& searchPath) {
90 std::vector<openstudio::path> existingSearchPaths = this->searchPaths();
91 if (std::find(existingSearchPaths.begin(), existingSearchPaths.end(), searchPath) != existingSearchPaths.end()) {
92 LOG(Info, "Not adding search path '" << searchPath << "' to PythonPlugin:SearchPaths since it is already present");
93 // Return true anyways, it's a success
94 return true;
95 }
96
97 auto eg = getObject<ModelObject>().pushExtensibleGroup().cast<WorkspaceExtensibleGroup>();
98 bool result = eg.setString(OS_PythonPlugin_SearchPathsExtensibleFields::SearchPath, searchPath.generic_string());
99 if (!result) {
100 getObject<ModelObject>().eraseExtensibleGroup(eg.groupIndex());
101 }
102
103 return result;
104 }
105
106 bool PythonPluginSearchPaths_Impl::setSearchPaths(const std::vector<openstudio::path>& searchPaths) {
107 bool result = true;

Callers 1

TEST_FFunction · 0.80

Calls 7

searchPathsMethod · 0.95
beginMethod · 0.80
pushExtensibleGroupMethod · 0.80
eraseExtensibleGroupMethod · 0.80
groupIndexMethod · 0.80
endMethod · 0.45
setStringMethod · 0.45

Tested by 1

TEST_FFunction · 0.64