Updated the SFML support stuff to use the Config that can be oriented at a BASE_DIR to find stuff relative to the config file.

This commit is contained in:
Zed A. Shaw 2025-05-13 02:02:47 -04:00
parent 4d71f552aa
commit de0d957c66
6 changed files with 28 additions and 8 deletions

View file

@ -4,8 +4,10 @@
using nlohmann::json;
using fmt::format;
std::filesystem::path Config::BASE_DIR{"."};
Config::Config(const std::string src_path) : $src_path(src_path) {
std::ifstream infile($src_path);
std::ifstream infile(Config::path_to($src_path));
$config = json::parse(infile);
}
@ -33,3 +35,12 @@ std::vector<std::string> Config::keys() {
return the_fucking_keys;
}
void Config::set_base_dir(const char *optarg) {
Config::BASE_DIR.assign(optarg);
}
std::filesystem::path Config::path_to(const std::string& path) {
return Config::BASE_DIR / path;
}