| 117 | |
| 118 | template <template <class ResourceType> class LoaderType, class ResourceType> |
| 119 | inline LoaderMultipleResult Path::loadAll(const LoaderType<ResourceType>& loader, |
| 120 | ResourceType& resource, bool allowFailure) const |
| 121 | { |
| 122 | std::vector<std::string> paths; |
| 123 | for (const MountablePath& mountedPath : m_mounts) |
| 124 | { |
| 125 | std::string loadPath = mountedPath.basePath |
| 126 | + ((!mountedPath.basePath.empty()) ? "/" : "") + this->m_path; |
| 127 | if (Utils::File::fileExists(loadPath) |
| 128 | || Utils::File::directoryExists(loadPath)) |
| 129 | { |
| 130 | Debug::Log->debug("<Path> Loading resource at : {0}", loadPath); |
| 131 | if (loader.load(resource, loadPath)) |
| 132 | { |
| 133 | paths.push_back(loadPath); |
| 134 | } |
| 135 | } |
| 136 | } |
| 137 | if (!allowFailure && paths.empty()) |
| 138 | throw Exceptions::ResourceNotFound( |
| 139 | m_path, MountablePath::StringPaths(), EXC_INFO); |
| 140 | else |
| 141 | return LoaderMultipleResult(paths); |
| 142 | } |
| 143 | } // namespace obe::System |
| 144 | |
| 145 | obe::System::Path operator"" _path(const char* str, std::size_t len); |
no test coverage detected