portable way of getting EXEDIR
This commit is contained in:
parent
dda5abb8e9
commit
0973f957c2
2
makefile
2
makefile
@ -5,7 +5,7 @@ MANPREFIX = ${PREFIX}/share/man
|
||||
#CC ?= gcc
|
||||
SRCDIR = ./src
|
||||
CFLAGS = -Wall -Werror -pedantic -O3 -std=c11 -fno-strict-aliasing \
|
||||
-I${SRCDIR} -I${PREFIX}/include/ -DLUA_USE_POSIX
|
||||
-I${SRCDIR} -I${PREFIX}/include/ -DLUA_USE_POSIX -D_PREFIX="${PREFIX}"
|
||||
# remove this
|
||||
LDFLAGS = -L${PREFIX}/lib -lSDL2 -lm -llua5.2
|
||||
FILES != find ${SRCDIR} -name '*.c'
|
||||
|
@ -26,10 +26,16 @@ static double get_scale(void)
|
||||
|
||||
static void get_exe_filename(char *buf, int sz)
|
||||
{
|
||||
#ifdef __linux__
|
||||
char path[512];
|
||||
sprintf(path, "/proc/%d/exe", getpid());
|
||||
int len = readlink(path, buf, sz - 1);
|
||||
buf[len] = '\0';
|
||||
#elif defined(_PREFIX)
|
||||
strncpy(buf, _PREFIX, sz);
|
||||
#else
|
||||
strncpy(buf, "/usr/local/share/lite/", sz);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void init_window_icon(void)
|
||||
|
Loading…
Reference in New Issue
Block a user