diff --git a/NEWS b/NEWS index 3107a602f..770a72aca 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,7 @@ ver 0.22.11 (not yet released) - ffmpeg: support double-precision samples (by converting to single precision) * Android - build with NDK r23 + - playlist_directory defaults to "/sdcard/Android/data/org.musicpd/files/playlists" ver 0.22.10 (2021/08/06) * protocol diff --git a/src/Main.cxx b/src/Main.cxx index 1a2a94ef5..c522fca61 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -157,7 +157,17 @@ glue_daemonize_init(const struct options *options, static void glue_mapper_init(const ConfigData &config) { - mapper_init(config.GetPath(ConfigOption::PLAYLIST_DIR)); + auto playlist_directory = config.GetPath(ConfigOption::PLAYLIST_DIR); + +#ifdef ANDROID + /* if there is no explicit configuration, store playlists in + "/sdcard/Android/data/org.musicpd/files/playlists" */ + if (playlist_directory.IsNull()) + playlist_directory = context->GetExternalFilesDir(Java::GetEnv(), + "playlists"); +#endif + + mapper_init(std::move(playlist_directory)); } #ifdef ENABLE_DATABASE