1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-03 00:38:44 +00:00

Add compile option to make unix use cwd as env (#12989)

Setting UNIX_CWD_ENV to 1 when compiling with the unix platform will make
the base path for the env the cwd. This is to be able to match the behavior on
Windows.
This commit is contained in:
Mats 2021-09-15 21:48:11 +02:00 committed by GitHub
parent 249e24fbe7
commit 6a59dad08c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

View File

@ -188,6 +188,10 @@ endif
ifeq ($(HAVE_UNIX), 1)
OBJ += frontend/drivers/platform_unix.o
ifeq ($(UNIX_CWD_ENV), 1)
DEF_FLAGS += -DRARCH_UNIX_CWD_ENV
endif
endif
ifeq ($(TARGET), retroarch_3ds)

View File

@ -107,6 +107,9 @@ bool fill_pathname_application_data(char *s, size_t len)
"Library/Application Support/RetroArch", len);
return true;
}
#elif defined(RARCH_UNIX_CWD_ENV)
getcwd(s, len);
return true;
#elif defined(DINGUX)
dingux_get_base_path(s, len);
return true;

View File

@ -1792,7 +1792,10 @@ static void frontend_unix_get_env(int *argc,
}
#else
char base_path[PATH_MAX] = {0};
#if defined(DINGUX)
#if defined(RARCH_UNIX_CWD_ENV)
/* The entire path is zero initialized. */
base_path[0] = '.';
#elif defined(DINGUX)
dingux_get_base_path(base_path, sizeof(base_path));
#else
const char *xdg = getenv("XDG_CONFIG_HOME");