Had to update everything to use Config::path_to for Config::BASE_DIR loading.

This commit is contained in:
Zed A. Shaw 2025-05-13 01:17:24 -04:00
parent eda7c30fc1
commit 2ef5a52928
5 changed files with 19 additions and 14 deletions

View file

@ -1,5 +1,5 @@
#include "guecs/sfml/sound.hpp"
#include "guecs/sfml/config.hpp"
#include "sound.hpp"
#include "config.hpp"
#include "dbc.hpp"
#include <fmt/core.h>
@ -31,14 +31,14 @@ namespace sound {
Config assets("assets/config.json");
for(auto& el : assets["sounds"].items()) {
load(el.key(), el.value());
load(el.key(), Config::path_to(el.value()));
}
initialized = true;
}
}
void load(const std::string& name, const std::string& sound_path) {
dbc::check(fs::exists(sound_path), fmt::format("sound file {} does not exist", sound_path));
void load(const std::string& name, const std::filesystem::path& sound_path) {
dbc::check(fs::exists(sound_path), fmt::format("sound file {} does not exist", sound_path.string()));
// create the buffer and keep in the buffer map
auto buffer = make_shared<sf::SoundBuffer>(sound_path);