diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2019-03-08 07:03:17 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2019-03-08 07:03:17 +0100 |
commit | ab34bbe232a6e5d4cc129e851ddd0d6b9d5ef9ff (patch) | |
tree | 66cad9b4d40d37fe325ec1bdcf8014d7a01b9fd2 /fbiconfig.c | |
parent | 69009b983a31efd4fb5a6d6a4b969ab9af2bba35 (diff) | |
download | fbida-ab34bbe232a6e5d4cc129e851ddd0d6b9d5ef9ff.tar.gz |
move config files to ~/.config/
Diffstat (limited to 'fbiconfig.c')
-rw-r--r-- | fbiconfig.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/fbiconfig.c b/fbiconfig.c index a986c3b..a8244a1 100644 --- a/fbiconfig.c +++ b/fbiconfig.c @@ -262,7 +262,7 @@ struct cfg_cmdline fbpdf_cfg[] = { static char *fbi_config = NULL; -static void init_config(const char *name) +static void init_config(const char *name, const char *old_name) { char *home; @@ -270,13 +270,19 @@ static void init_config(const char *name) if (NULL == home) return; + fbi_config = malloc(strlen(home) + strlen(old_name) + 2); + sprintf(fbi_config, "%s/%s", home, old_name); + if (access(fbi_config, F_OK) == 0) + return; + + free(fbi_config); fbi_config = malloc(strlen(home) + strlen(name) + 2); - sprintf(fbi_config,"%s/%s", home, name); + sprintf(fbi_config, "%s/%s", home, name); } -void fbi_read_config(const char *name) +void fbi_read_config(const char *name, const char *old_name) { - init_config(name); + init_config(name, old_name); if (fbi_config) cfg_parse_file("config", fbi_config); } |