fs/StandardDirectory: add GetUserCacheDir()

Move code from CreateConfiguredDatabase() and add XDG support.  This
implements an automatic Linux fallback for the setting "db_file" if
none was specified.
This commit is contained in:
Max Kellermann
2014-03-01 22:50:11 +01:00
parent efa6678bcc
commit 36ca57a54e
4 changed files with 26 additions and 15 deletions

View File

@@ -50,6 +50,8 @@
#ifdef ANDROID
#include "java/Global.hxx"
#include "android/Environment.hxx"
#include "android/Context.hxx"
#include "Main.hxx"
#endif
#ifndef WIN32
@@ -252,6 +254,18 @@ AllocatedPath GetUserMusicDir()
#endif
}
AllocatedPath
GetUserCacheDir()
{
#ifdef USE_XDG
return GetUserDir("XDG_CACHE_DIR");
#elif defined(ANDROID)
return context->GetCacheDir(Java::GetEnv());
#else
return AllocatedPath::Null();
#endif
}
#ifdef WIN32
AllocatedPath GetSystemConfigDir()