44 repos = ucx_map_new(16); |
44 repos = ucx_map_new(16); |
45 keys = ucx_map_new(16); |
45 keys = ucx_map_new(16); |
46 |
46 |
47 char *file = util_concat_path(getenv("HOME"), ".dav/config.xml"); |
47 char *file = util_concat_path(getenv("HOME"), ".dav/config.xml"); |
48 xmlDoc *doc = xmlReadFile(file, NULL, 0); |
48 xmlDoc *doc = xmlReadFile(file, NULL, 0); |
|
49 if(!doc) { |
|
50 doc = xmlNewDoc(BAD_CAST "1.0"); |
|
51 xmlNode *root = xmlNewNode(NULL, BAD_CAST "configuration"); |
|
52 xmlDocSetRootElement(doc, root); |
|
53 xmlSaveFormatFileEnc(file, doc, "UTF-8", 1); |
|
54 xmlFreeDoc(doc); |
|
55 free(file); |
|
56 return; |
|
57 } |
49 free(file); |
58 free(file); |
50 |
59 |
51 xmlNode *xml_root = xmlDocGetRootElement(doc); |
60 xmlNode *xml_root = xmlDocGetRootElement(doc); |
52 xmlNode *node = xml_root->children; |
61 xmlNode *node = xml_root->children; |
53 while(node) { |
62 while(node) { |