From c0048bc24f7f7aa21ccdf9086cede5d402744a18 Mon Sep 17 00:00:00 2001 From: SarahW Date: Thu, 14 Dec 2017 18:49:09 +0000 Subject: [PATCH] Fixed handling of configurations with full stops in the name. --- src/pc.c | 14 ++++++-------- src/wx-config_sel.c | 18 +----------------- 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/src/pc.c b/src/pc.c index b7e3547..472677a 100644 --- a/src/pc.c +++ b/src/pc.c @@ -249,22 +249,20 @@ void initpc(int argc, char *argv[]) } else if (!strcasecmp(argv[c], "--config")) { - int d; + char *ext; if ((c+1) == argc) break; strncpy(config_file_default, argv[c+1], 256); strcpy(config_name, get_filename(config_file_default)); - for (d = 0; d < strlen(config_name); d++) + ext = get_extension(config_name); + if (ext && ext[0]) { - if (config_name[d] == '.') - { - config_name[d] = 0; - break; - } + ext--; + *ext = 0; } - + config_override = 1; c++; } diff --git a/src/wx-config_sel.c b/src/wx-config_sel.c index e4253a3..b21f307 100644 --- a/src/wx-config_sel.c +++ b/src/wx-config_sel.c @@ -32,7 +32,7 @@ static void select_config(void* hdlg, char* name) static void config_list_update(void* hdlg) { char s[512]; - int num, c, p; + int num, p; void* h; strcpy(s, configs_path); @@ -47,22 +47,6 @@ static void config_list_update(void* hdlg) num = wx_sendmessage(h, WX_LB_GETCOUNT, 0, 0); - for (c = 0; c < num; c++) - { - char *ext; - - wx_sendmessage(h, WX_LB_GETTEXT, c, (LONG_PARAM)s); - ext = get_extension(s); - if (ext && ext[0]) - { - ext--; - *ext = 0; - } - - wx_sendmessage(h, WX_LB_DELETESTRING, c, 0); - wx_sendmessage(h, WX_LB_INSERTSTRING, c, (LONG_PARAM)s); - } - if (num > 0) { if (p >= num)