3 #include <utility/String.h>
4 #include "IResourceProvider.h"
8 const std::string FILESYSTEM_ROOT_FOLDER =
"resources";
9 const std::string FILESYSTEM_PROVIDER_NAME =
"file";
13 explicit FilesystemResourceProvider(std::string path_,
bool isPathAbsolute =
false,
const std::string& name_ = FILESYSTEM_PROVIDER_NAME);
14 [[nodiscard]]
bool hasResource(std::string_view name)
const override;
15 void compileResource(std::string_view name,
Resource* resource)
const override;
16 [[nodiscard]] std::string_view getPath()
const {
19 [[nodiscard]]
bool isAbsolute()
const {
20 return this->absolute;
22 [[nodiscard]] std::string getFolder()
const;
23 [[nodiscard]] std::string getLocalResourceAbsolutePath(
const std::string& identifier)
const;
37 static constexpr
inline short FILEPATH_MAX_LENGTH = 1024;
static std::string getResourceIdentifier(std::string_view absolutePath)
Takes an absolute path of a resource file and converts it to a resource identifier.
static void nixifyPath(std::string &path)
Converts all backslashes in a string to forward slashes.
static std::string getResourceAbsolutePath(const std::string &identifier)
Takes a resource identifier and returns the full absolute path, if it exists.
static std::string getResourceFolderPath(std::string_view absolutePath)
Takes an absolute path of a resource folder and converts it to a valid input path for a FilesystemRes...
A chunk of data, usually a file. Is typically cached and shared.