| 110 | } |
| 111 | |
| 112 | path ExternalFile_Impl::filePath() const { |
| 113 | path result; |
| 114 | path fname = toPath(fileName()); |
| 115 | if (openstudio::filesystem::is_regular_file(fname)) { |
| 116 | return fname; |
| 117 | } |
| 118 | std::vector<path> absoluteFilePaths = this->model().workflowJSON().absoluteFilePaths(); |
| 119 | if (absoluteFilePaths.empty()) { |
| 120 | result = this->model().workflowJSON().absoluteRootDir() / fname; |
| 121 | } else { |
| 122 | // Loop to find the file in all possible directories in order of preference |
| 123 | // (eg goes to hardcoded paths, then potentially generated_files, then files, etc.) |
| 124 | for (const openstudio::path& dirpath : absoluteFilePaths) { |
| 125 | path p = dirpath / fname; |
| 126 | if (openstudio::filesystem::is_regular_file(p)) { |
| 127 | result = p; |
| 128 | break; |
| 129 | } |
| 130 | } |
| 131 | } |
| 132 | return result; |
| 133 | } |
| 134 | |
| 135 | //boost::optional<std::string> ExternalFile_Impl::columnSeparator() const { |
| 136 | // return getString(OS_External_FileFields::ColumnSeparator,true); |