MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / loadAll

Method loadAll

include/Core/System/Path.hpp:119–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
145obe::System::Path operator"" _path(const char* str, std::size_t len);

Callers 1

loadMethod · 0.80

Calls 8

fileExistsFunction · 0.85
directoryExistsFunction · 0.85
ResourceNotFoundClass · 0.85
debugMethod · 0.80
emptyMethod · 0.45
loadMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected