context: Add program directory's path

This commit is contained in:
2026-01-13 15:30:30 +01:00
parent 8f7b735820
commit c4725847cc
3 changed files with 36 additions and 30 deletions

View File

@@ -82,6 +82,15 @@ int main(int ac, char **av) {
context->config_json["fps"] = 800;
}
// Get program directory
char path_buf[1024];
ssize_t len = readlink("/proc/self/exe", path_buf, sizeof(path_buf)-1);
if (len == -1) {
std::cerr << "Failed to determine program directory" << std::endl;
return 1;
}
context->program_dir = std::filesystem::path(path_buf).parent_path();
InitWindow(context->config_json["screen_width"], context->config_json["screen_height"],
&av[0][2]);