context: Add program directory's path
This commit is contained in:
@@ -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]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user