From afdb661f216faf1d26c39f3f3cdb9bcb182d9bfc Mon Sep 17 00:00:00 2001 From: Themaister Date: Sun, 28 Apr 2013 23:16:33 +0200 Subject: [PATCH] Use a safer way to get default config. --- settings.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/settings.c b/settings.c index 446a02238b..f77547068f 100644 --- a/settings.c +++ b/settings.c @@ -308,15 +308,18 @@ static config_file_t *open_default_config_file(void) #if defined(_WIN32) && !defined(_XBOX) char conf_path[PATH_MAX]; - // Just do something for now. - strlcpy(conf_path, "retroarch.cfg", sizeof(conf_path)); + + char app_path[PATH_MAX]; + fill_pathname_application_path(app_path, sizeof(app_path)); + fill_pathname_resolve_relative(conf_path, app_path, "retroarch.cfg", sizeof(conf_path)); + conf = config_file_new(conf_path); if (!conf) { const char *appdata = getenv("APPDATA"); if (appdata) { - snprintf(conf_path, sizeof(conf_path), "%s/retroarch.cfg", appdata); + snprintf(conf_path, sizeof(conf_path), "%s\\retroarch.cfg", appdata); conf = config_file_new(conf_path); } }