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

Method makeUrlRelative

src/model/WeatherFile.cpp:277–293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

275 }
276
277 bool WeatherFile_Impl::makeUrlRelative(const openstudio::path& basePath) {
278 boost::optional<openstudio::path> currentPath = this->path();
279 if (currentPath) {
280 openstudio::path newPath;
281 if (basePath.empty()) {
282 newPath = currentPath->filename();
283 } else {
284 newPath = relativePath(*currentPath, basePath);
285 }
286 if (!newPath.empty()) {
287 std::string weatherFileUrl = toString(newPath);
288 LOG(Debug, "Setting weather file url to " << weatherFileUrl);
289 return setString(OS_WeatherFileFields::Url, weatherFileUrl);
290 }
291 }
292 return false;
293 }
294
295 bool WeatherFile_Impl::makeUrlAbsolute(const openstudio::path& searchDirectory) {
296 boost::optional<openstudio::path> currentPath = this->path();

Callers

nothing calls this directly

Calls 5

pathMethod · 0.95
relativePathFunction · 0.85
filenameMethod · 0.80
toStringFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected