all repos — mgba @ e51285a0db00d1ec3cbd352e87d496df788d590d

mGBA Game Boy Advance Emulator

GBA Config: Load config from the correct location on Windows
Jeffrey Pfau jeffrey@endrift.com
Tue, 11 Nov 2014 02:07:50 -0800
commit

e51285a0db00d1ec3cbd352e87d496df788d590d

parent

20c5c27bf91f8b38984fda4c74479cf449294012

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

jump to
M src/gba/gba-config.csrc/gba/gba-config.c

@@ -102,8 +102,14 @@ }

bool GBAConfigLoad(struct GBAConfig* config) { char path[PATH_MAX]; +#ifndef _WIN32 char* home = getenv("HOME"); snprintf(path, PATH_MAX, "%s/.config/%s/config.ini", home, BINARY_NAME); +#else + char home[MAX_PATH]; + SHGetFolderPath(0, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, home); + snprintf(path, PATH_MAX, "%s/%s/config.ini", home, PROJECT_NAME); +#endif return ConfigurationRead(&config->configTable, path); }