| 32 | } |
| 33 | |
| 34 | InputStream MultiFileLoader::loadFile(std::string_view path) { |
| 35 | auto it = _cacheWhere.find(path); |
| 36 | if (it != _cacheWhere.end()) { |
| 37 | return _providers[it->second]->load(path); |
| 38 | } |
| 39 | |
| 40 | int i = 0; |
| 41 | for (const auto &provider : _providers) { |
| 42 | if (provider->has(path)) { |
| 43 | _cacheWhere[path] = i; |
| 44 | return provider->load(path); |
| 45 | } |
| 46 | ++i; |
| 47 | } |
| 48 | |
| 49 | throw std::runtime_error(absl::StrCat("File not found: ", path)); |
| 50 | } |
| 51 | |
| 52 | bool MultiFileLoader::fileExists(std::string_view path) { |
| 53 | auto it = _cacheWhere.find(path); |