aboutsummaryrefslogtreecommitdiffstats
path: root/src/confparser.c
diff options
context:
space:
mode:
authorAnastasis Grammenos <anastasis.gramm2@gmail.com>2018-09-18 19:18:01 +0300
committerAnastasis Grammenos <anastasis.gramm2@gmail.com>2018-09-18 19:18:01 +0300
commit8702ce8bbd4d1435cc81fa8fcd7f5309d3c7b003 (patch)
tree8ce1b6f62ee2cd7d527f23928b20e7b2a1853388 /src/confparser.c
parentaf17ead850f90cf6e4476aa74975e68d7293fb27 (diff)
downloadck-8702ce8bbd4d1435cc81fa8fcd7f5309d3c7b003.tar.gz
ck-8702ce8bbd4d1435cc81fa8fcd7f5309d3c7b003.tar.bz2
ck-8702ce8bbd4d1435cc81fa8fcd7f5309d3c7b003.zip
VC and secret dir are now stored with absolute path
Diffstat (limited to 'src/confparser.c')
-rw-r--r--src/confparser.c12
1 files changed, 7 insertions, 5 deletions
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);