void-packages/srcpkgs/foobillard++/patches/data-dir.patch

44 lines
1.3 KiB
Diff
Raw Normal View History

diff --git src/sys_stuff.c src/sys_stuff.c
index 8f65f6b..7b905cf 100644
--- src/sys_stuff.c
+++ src/sys_stuff.c
@@ -756,37 +756,18 @@ void sys_main_loop(void) {
* Find the program's "data" directory and chdir into it *
***********************************************************************/
-static char data_dir[512];
+static char data_dir[512] = "/usr/share/foobillardplus";
void enter_data_dir() {
int success = 1;
#ifdef POSIX
- char proc_exe[20];
- char *slash_pos;
#endif
do {
success = 0;
#ifdef POSIX
- snprintf(proc_exe, sizeof(proc_exe), "/proc/%d/exe", getpid());
- if (readlink(proc_exe, data_dir, sizeof(data_dir)) < 0) {
- perror("readlink failed");
- break;
- }
-
- // Remove program name
- slash_pos = strrchr(data_dir, '/');
- if (!slash_pos) break;
- *slash_pos = '\0';
-
- // Go one dir up
- slash_pos = strrchr(data_dir, '/');
- if (!slash_pos) break;
-
- // Add "/data"
- strncpy(slash_pos, "/data", sizeof(data_dir) - (slash_pos - data_dir));
#else
/* ### TODO ### Get the working directory of the program
* Mac OS X: _NSGetExecutablePath() (man 3 dyld)