Main: playlist_directory defaults to "/sdcard/Android/data/org.musicpd/files/playlists"

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1233
This commit is contained in:
Max Kellermann 2021-08-24 22:11:54 +02:00
parent 2dba06dc34
commit 263d1ba002
2 changed files with 12 additions and 1 deletions

1
NEWS
View File

@ -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

View File

@ -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