From a9d7a08c2e9571056d5d540aa2f60d21264db6d9 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Sun, 9 Mar 2008 20:01:32 +0100 Subject: [PATCH] Add support for ~ in include() from awesome --- common/configopts.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/common/configopts.c b/common/configopts.c index e827fd007..36033cbfc 100644 --- a/common/configopts.c +++ b/common/configopts.c @@ -43,6 +43,7 @@ static int cfg_awesome_include(cfg_t *cfg, cfg_opt_t *opt, int argc, const char **argv) { + char *filename; FILE *fp; if(argc != 1 || !a_strlen(argv[0])) @@ -51,12 +52,16 @@ cfg_awesome_include(cfg_t *cfg, cfg_opt_t *opt, return 0; } - if(!(fp = fopen(argv[0], "r"))) + filename = cfg_tilde_expand(argv[0]); + + if(!(fp = fopen(filename, "r"))) { - cfg_error(cfg, "cannot include configuration file %s: %s", argv[0], strerror(errno)); + cfg_error(cfg, "cannot include configuration file %s: %s", + filename, strerror(errno)); return 0; } + p_delete(&filename); fclose(fp); return cfg_include(cfg, opt, argc, argv);