void-packages/srcpkgs/foobillard++/patches/data-dir.patch
Đoàn Trần Công Danh be5369a0cb srcpkgs/f*: convert patches to -Np1
* fpc is kept at -Np0

```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

43 lines
1.3 KiB
Diff

diff --git src/sys_stuff.c src/sys_stuff.c
index 8f65f6b..7b905cf 100644
--- a/src/sys_stuff.c
+++ b/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)