all repos — mgba @ 88fc68aaf79ad817b13a5a9a81c68691219aa82d

mGBA Game Boy Advance Emulator

Core: Obey the XDG basedir specification for environment variables
Emmanuel Gil Peyrot linkmauve@linkmauve.fr
Sun, 07 Aug 2016 00:05:06 +0100
commit

88fc68aaf79ad817b13a5a9a81c68691219aa82d

parent

67a09eaa1d4132c8ffef3178ea0875102153609d

1 files changed, 6 insertions(+), 0 deletions(-)

jump to
M src/core/config.csrc/core/config.c

@@ -227,6 +227,12 @@ portable->close(portable);

return; } + char* xdgConfigHome = getenv("XDG_CONFIG_HOME"); + if (xdgConfigHome && xdgConfigHome[0] == '/') { + snprintf(out, outLength, "%s/%s", xdgConfigHome, binaryName); + mkdir(out, 0755); + return; + } char* home = getenv("HOME"); snprintf(out, outLength, "%s/.config", home); mkdir(out, 0755);