From b698e434f564afb85eb7a953026dc2a9f6b9cad3 Mon Sep 17 00:00:00 2001 From: radius Date: Fri, 10 Jul 2015 23:07:44 -0500 Subject: [PATCH] make it prefer the drivername subdir if it exists when saving --- configuration.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/configuration.c b/configuration.c index eca189172f..efd6a8d9a6 100644 --- a/configuration.c +++ b/configuration.c @@ -2350,13 +2350,21 @@ bool config_save_autoconf_profile(const char *path, unsigned user) settings_t *settings = config_get_ptr(); fill_pathname_join(buf, settings->input.autoconfig_dir, - input.joypad_driver, sizeof(buf)); - - if(!path_is_directory(buf)) + settings->input.joypad_driver, sizeof(buf)); + + if(path_is_directory(buf)) + { + fill_pathname_join(buf, buf, + path, sizeof(buf)); + fill_pathname_noext(autoconf_file, buf, ".cfg", sizeof(autoconf_file)); + } + else + { + fill_pathname_join(buf, settings->input.autoconfig_dir, path, sizeof(buf)); - - fill_pathname_noext(autoconf_file, buf, ".cfg", sizeof(autoconf_file)); + fill_pathname_noext(autoconf_file, buf, ".cfg", sizeof(autoconf_file)); + } conf = config_file_new(autoconf_file);