diff options
author | Max Kellermann <max@duempel.org> | 2014-03-01 17:46:59 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-03-01 18:48:20 +0100 |
commit | 58771fc41c411769d3ab7248c7fab00e8dbbecef (patch) | |
tree | 2c63049a00e19a32931771162c3e94320f4e146d /src/fs/StandardDirectory.cxx | |
parent | 1e06c66c776e2dca217059d7d94309b0c5431a3f (diff) | |
download | mpd-58771fc41c411769d3ab7248c7fab00e8dbbecef.tar.gz mpd-58771fc41c411769d3ab7248c7fab00e8dbbecef.tar.xz mpd-58771fc41c411769d3ab7248c7fab00e8dbbecef.zip |
Android: obtain music directory from Environment.getExternalStoragePublicDirectory()
Diffstat (limited to '')
-rw-r--r-- | src/fs/StandardDirectory.cxx | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/fs/StandardDirectory.cxx b/src/fs/StandardDirectory.cxx index 4f0958995..fce54a677 100644 --- a/src/fs/StandardDirectory.cxx +++ b/src/fs/StandardDirectory.cxx @@ -20,7 +20,7 @@ #include "config.h" // Use X Desktop guidelines where applicable -#if !defined(__APPLE__) && !defined(WIN32) +#if !defined(__APPLE__) && !defined(WIN32) && !defined(ANDROID) #define USE_XDG #endif @@ -47,6 +47,11 @@ #include <utility> #endif +#ifdef ANDROID +#include "java/Global.hxx" +#include "android/Environment.hxx" +#endif + #ifndef WIN32 class PasswdEntry { @@ -240,6 +245,14 @@ AllocatedPath GetUserMusicDir() return GetStandardDir(CSIDL_MYMUSIC); #elif defined(USE_XDG) return GetUserDir("XDG_MUSIC_DIR"); +#elif defined(ANDROID) + char buffer[1024]; + if (Environment::getExternalStoragePublicDirectory(buffer, + sizeof(buffer), + "Music") == nullptr) + return AllocatedPath::Null(); + + return AllocatedPath::FromUTF8(buffer); #else return AllocatedPath::Null(); #endif |