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

Method load

include/Core/System/Path.hpp:94–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92
93 template <template <class ResourceType> class LoaderType, class ResourceType>
94 inline LoaderResult Path::load(const LoaderType<ResourceType>& loader,
95 ResourceType& resource, bool allowFailure) const
96 {
97 for (const MountablePath& mountedPath : m_mounts)
98 {
99 std::string loadPath = mountedPath.basePath
100 + ((!mountedPath.basePath.empty()) ? "/" : "") + this->m_path;
101 if (Utils::File::fileExists(loadPath)
102 || Utils::File::directoryExists(loadPath))
103 {
104 Debug::Log->debug("<Path> Loading resource at : {0}", loadPath);
105 if (loader.load(resource, loadPath))
106 {
107 return LoaderResult(loadPath);
108 }
109 }
110 }
111 if (allowFailure)
112 return LoaderResult();
113 else
114 throw Exceptions::ResourceNotFound(
115 m_path, MountablePath::StringPaths(), EXC_INFO);
116 }
117
118 template <template <class ResourceType> class LoaderType, class ResourceType>
119 inline LoaderMultipleResult Path::loadAll(const LoaderType<ResourceType>& loader,

Callers 1

loadAllMethod · 0.45

Calls 6

fileExistsFunction · 0.85
directoryExistsFunction · 0.85
LoaderResultClass · 0.85
ResourceNotFoundClass · 0.85
debugMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected