32 {
33 namespace fs = std::filesystem;
34
35 std::string build_path = "data/" + rel;
36
37 std::string install_path = std::string(
DATA_DIR) +
"/" + rel;
38
39 std::string userBase;
40 if (const char* xdg = std::getenv("XDG_DATA_HOME"); xdg && *xdg) {
41 userBase = std::string(xdg);
42 } else if (const char* home = std::getenv("HOME"); home) {
43 userBase = std::string(home) + "/.local/share";
44 }
45 std::string user_path = userBase + "/BastionGuard/data/" + rel;
46
47 if (fs::exists(build_path)) return build_path;
48 if (!userBase.empty() && fs::exists(user_path)) return user_path;
49 if (fs::exists(install_path)) return install_path;
50
51 std::cerr << "⚠ Risorsa non trovata: " << rel << std::endl;
52 return install_path;
53}