| 293 | } |
| 294 | |
| 295 | bool WeatherFile_Impl::makeUrlAbsolute(const openstudio::path& searchDirectory) { |
| 296 | boost::optional<openstudio::path> currentPath = this->path(); |
| 297 | if (currentPath) { |
| 298 | if (currentPath->is_complete() && openstudio::filesystem::exists(*currentPath)) { |
| 299 | return true; |
| 300 | } |
| 301 | openstudio::path newPath; |
| 302 | openstudio::path workingPath(*currentPath); |
| 303 | if (!currentPath->is_complete()) { |
| 304 | newPath = openstudio::filesystem::system_complete(workingPath); |
| 305 | LOG(Debug, "Current path '" << toString(*currentPath) << "' not complete. " << "After calling system_complete have '" << toString(newPath) |
| 306 | << "'."); |
| 307 | } |
| 308 | if (newPath.empty() || !openstudio::filesystem::exists(newPath)) { |
| 309 | newPath = searchDirectory / *currentPath; |
| 310 | LOG(Debug, "Going to look for '" << toString(newPath) << "'."); |
| 311 | } |
| 312 | if (newPath.empty() || !openstudio::filesystem::exists(newPath)) { |
| 313 | workingPath = currentPath->filename(); |
| 314 | newPath = searchDirectory / workingPath; |
| 315 | LOG(Debug, "Going to look for '" << toString(newPath) << "'."); |
| 316 | } |
| 317 | if (newPath.empty() || !openstudio::filesystem::exists(newPath)) { |
| 318 | return false; |
| 319 | } |
| 320 | std::string weatherFileUrl = toString(newPath); |
| 321 | LOG(Debug, "Setting weather file url to " << weatherFileUrl); |
| 322 | return setString(OS_WeatherFileFields::Url, weatherFileUrl); |
| 323 | } |
| 324 | return false; |
| 325 | } |
| 326 | |
| 327 | boost::optional<std::string> WeatherFile_Impl::environmentName() const { |
| 328 | OptionalString result; |