dav/config.c

changeset 6
9c64d2a3d101
parent 5
88625853ae74
child 7
d9bdd5a22c1d
equal deleted inserted replaced
5:88625853ae74 6:9c64d2a3d101
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) {

mercurial