libsaria: Use absolute paths for saria dirs

I noticed that new save files weren't being created.  I now use the HOME
environment variable to construct an absolute path to write files to.
This commit is contained in:
Bryan Schumaker 2011-12-11 11:23:43 -05:00
parent a14cedc942
commit 0b4d9c25eb
1 changed files with 7 additions and 3 deletions

View File

@ -60,10 +60,14 @@ void readdir(string dir, list<file> &files, list<file> &dirs)
string get_saria_dir()
{
string saria = ".config";
char *xdg = getenv("XDG_CONFIG_HOME");
string saria = getenv("HOME");
char *xdg = getenv("XDG_CONFIG_HOME");
saria += "/";
if (xdg != NULL)
saria = xdg;
saria += xdg;
else
saria += ".config";
return saria += SARIA_DIR;
}