* Find a path to the filename in one of the search directories. * @param subdir Subdirectory to try. * @param filename Filename to look for. * @return String containing the path if the path was found, else an empty string. */
| 142 | * @return String containing the path if the path was found, else an empty string. |
| 143 | */ |
| 144 | std::string FioFindFullPath(Subdirectory subdir, std::string_view filename) |
| 145 | { |
| 146 | assert(subdir < NUM_SUBDIRS); |
| 147 | |
| 148 | for (Searchpath sp : _valid_searchpaths) { |
| 149 | std::string buf = FioGetDirectory(sp, subdir); |
| 150 | buf += filename; |
| 151 | if (FileExists(buf)) return buf; |
| 152 | #if !defined(_WIN32) |
| 153 | /* Be, as opening files, aware that sometimes the filename |
| 154 | * might be in uppercase when it is in lowercase on the |
| 155 | * disk. Of course Windows doesn't care about casing. */ |
| 156 | if (strtolower(buf, _searchpaths[sp].size() - 1) && FileExists(buf)) return buf; |
| 157 | #endif |
| 158 | } |
| 159 | |
| 160 | return {}; |
| 161 | } |
| 162 | |
| 163 | std::string FioGetDirectory(Searchpath sp, Subdirectory subdir) |
| 164 | { |
no test coverage detected