18#include "sdl_resource_manager.hpp"
20#include "../filesystem.hpp"
27std::string SDLResourceManager::typeImages()
32void SDLResourceManager::insert(
const std::string& type,
const std::string&
id,
33 const std::vector<unsigned char>& data)
35 std::string uuid = type +
"/" + id;
36 resources().emplace(uuid, data);
39bool SDLResourceManager::useCompiledResources()
41#if defined(SDL_USE_COMPILED_RESOURCES)
48const std::vector<unsigned char>* SDLResourceManager::data(
const std::string& type,
49 const std::string&
id)
51#if defined(SDL_USE_COMPILED_RESOURCES)
52 std::string uuid = type +
"/" + id;
53 auto val = resources().find(uuid);
54 if (val == resources().end())
63std::string SDLResourceManager::filename([[maybe_unused]]
const std::string& type,
64 [[maybe_unused]]
const std::string&
id)
66#if defined(SDL_RESOURCE_ROOT)
67 std::string uuid = type +
"/" + id;
68 fs::path path(SDL_RESOURCE_ROOT);
72 if (!fs::exists(path))
74 std::cerr <<
"sdl-freerdp expects resource '" << uuid <<
"' at location "
75 << fs::absolute(path) << std::endl;
76 std::cerr <<
"file not found, application will fail" << std::endl;
79 return path.u8string();
85std::map<std::string, std::vector<unsigned char>>& SDLResourceManager::resources()
88 static std::map<std::string, std::vector<unsigned char>> resources = {};
89#if defined(SDL_USE_COMPILED_RESOURCES)
90 if (resources.empty())
static std::string typeFonts()