# HG changeset patch # User Olaf Wintermann # Date 1376312131 -7200 # Node ID 9c64d2a3d10152e86e2c02cd66369c7e7fc5609c # Parent 88625853ae744ce389be155fad4c8c4bf8f59bf8 creates an empty configuration file if needed diff -r 88625853ae74 -r 9c64d2a3d101 dav/config.c --- a/dav/config.c Mon Aug 12 14:40:19 2013 +0200 +++ b/dav/config.c Mon Aug 12 14:55:31 2013 +0200 @@ -46,6 +46,15 @@ char *file = util_concat_path(getenv("HOME"), ".dav/config.xml"); xmlDoc *doc = xmlReadFile(file, NULL, 0); + if(!doc) { + doc = xmlNewDoc(BAD_CAST "1.0"); + xmlNode *root = xmlNewNode(NULL, BAD_CAST "configuration"); + xmlDocSetRootElement(doc, root); + xmlSaveFormatFileEnc(file, doc, "UTF-8", 1); + xmlFreeDoc(doc); + free(file); + return; + } free(file); xmlNode *xml_root = xmlDocGetRootElement(doc);