From 58771fc41c411769d3ab7248c7fab00e8dbbecef Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 1 Mar 2014 17:46:59 +0100 Subject: Android: obtain music directory from Environment.getExternalStoragePublicDirectory() --- src/fs/StandardDirectory.cxx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/fs') 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 #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 -- cgit v1.2.3