# HG changeset patch # User Olaf Wintermann # Date 1507035575 -7200 # Node ID 2433b5969d44c84eb0dd4403d5d84ea69250a77a # Parent 7e06944238383f946144a7772e0d2b7388322e14 disables automatic creation of .dav directory in dav diff -r 7e0694423838 -r 2433b5969d44 dav/config.c --- a/dav/config.c Sun Oct 01 17:37:59 2017 +0200 +++ b/dav/config.c Tue Oct 03 14:59:35 2017 +0200 @@ -99,9 +99,6 @@ // TODO: free the config somewhere repos = ucx_map_new(16); keys = ucx_map_new(16); - if(check_config_dir()) { - return 1; - } char *file = util_concat_path(ENV_HOME, ".dav/config.xml"); @@ -109,7 +106,6 @@ if(stat(file, &s)) { switch(errno) { case ENOENT: { - create_default_config(file); return 0; } default: { @@ -589,7 +585,27 @@ } int add_repository(Repository *repo) { + if(check_config_dir()) { + fprintf(stderr, "Cannot create .dav directory\n"); + return 1; + } + char *file = util_concat_path(ENV_HOME, ".dav/config.xml"); + struct stat s; + if(stat(file, &s)) { + switch(errno) { + case ENOENT: { + create_default_config(file); + break; + } + default: { + perror("Cannot load config.xml"); + free(file); + return 1; + } + } + } + xmlDoc *doc = xmlReadFile(file, NULL, 0); if(!doc) { free(file); diff -r 7e0694423838 -r 2433b5969d44 dav/config.h --- a/dav/config.h Sun Oct 01 17:37:59 2017 +0200 +++ b/dav/config.h Tue Oct 03 14:59:35 2017 +0200 @@ -67,6 +67,8 @@ unsigned long authmethods; }; +int check_config_dir(void); + char* config_file_path(char *name); int load_config(DavContext *ctx); diff -r 7e0694423838 -r 2433b5969d44 dav/scfg.c --- a/dav/scfg.c Sun Oct 01 17:37:59 2017 +0200 +++ b/dav/scfg.c Tue Oct 03 14:59:35 2017 +0200 @@ -35,6 +35,7 @@ #include #include "scfg.h" +#include "config.h" #define xstreq(a,b) xmlStrEqual(BAD_CAST a, BAD_CAST b) @@ -273,6 +274,11 @@ int load_sync_config() { directories = ucx_map_new(8); + if(check_config_dir()) { + fprintf(stderr, "Cannot create .dav directory\n"); + return 1; + } + char *file = util_concat_path(ENV_HOME, ".dav/sync.xml"); struct stat s; diff -r 7e0694423838 -r 2433b5969d44 dav/version.h --- a/dav/version.h Sun Oct 01 17:37:59 2017 +0200 +++ b/dav/version.h Tue Oct 03 14:59:35 2017 +0200 @@ -29,7 +29,7 @@ #ifndef VERSION_H #define VERSION_H -#define DAV_VERSION "1.0 dev" +#define DAV_VERSION "1.1 RC1" #endif /* VERSION_H */