Add XDG Base Directory Specification support to Util::createXML

I forgot to change Util::createXML in d430af6
This commit is contained in:
Sude 2014-02-17 14:26:12 +02:00
parent 1c26af48d2
commit cae29a1c1d

View File

@ -81,9 +81,18 @@ int Util::createXML(std::string filepath, size_t chunk_size, std::string xml_dir
FILE *xmlfile;
size_t filesize, size;
int chunks, i;
std::string home = (std::string)getenv("HOME");
if (xml_dir.empty())
xml_dir = home + "/.gogdownloader/xml";
{
char *xdgcache = getenv("XDG_CACHE_HOME");
if (xdgcache)
xml_dir = (std::string)xdgcache + "/lgogdownloader/xml";
else
{
std::string home = (std::string)getenv("HOME");
xml_dir = home + "/.cache/lgogdownloader/xml";
}
}
// Make sure directory exists
boost::filesystem::path path = xml_dir;