From 8702ce8bbd4d1435cc81fa8fcd7f5309d3c7b003 Mon Sep 17 00:00:00 2001 From: Anastasis Grammenos Date: Tue, 18 Sep 2018 19:18:01 +0300 Subject: VC and secret dir are now stored with absolute path --- src/confparser.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/confparser.c') diff --git a/src/confparser.c b/src/confparser.c index 5754dfa..948623c 100644 --- a/src/confparser.c +++ b/src/confparser.c @@ -139,17 +139,19 @@ void free_conf(Conf *conf) { } int init_create_config_file(UserOpt *opt) { - if (!util_file_exists(list_get_at(opt->args, 0))) { + char absVCdir[STR_L]; + if (!util_file_exists(list_get_at(opt->args, 0), absVCdir)) { printf("Version control directory: %s\ndoes not exist.\n", list_get_at(opt->args, 0)); return 1; } - if (!util_file_exists(list_get_at(opt->args, 1))) { + char absSRdir[STR_L]; + if (!util_file_exists(list_get_at(opt->args, 1), absSRdir)) { printf("Secret directory: %s\ndoes not exist.\n", list_get_at(opt->args, 1)); return 1; } - if (!util_file_exists(opt->confDir)) { + if (!util_file_exists(opt->confDir, NULL)) { util_mkdir(opt->confDir); } @@ -162,12 +164,12 @@ int init_create_config_file(UserOpt *opt) { char tmp[200]; strcpy(tmp, "version_control_dir = "); - strcat(tmp, list_get_at(opt->args, 0)); + strcat(tmp, absVCdir); strcat(tmp, "\n"); fputs(tmp, f); strcpy(tmp, "secret_dir = "); - strcat(tmp, list_get_at(opt->args, 1)); + strcat(tmp, absSRdir); strcat(tmp, "\n"); fputs(tmp, f); -- cgit v1.2.3