Main: load Android mpd.conf from ExternalFilesDir
See also https://github.com/MusicPlayerDaemon/MPD/issues/1061 Closes https://github.com/MusicPlayerDaemon/MPD/issues/1570
This commit is contained in:
parent
7778210269
commit
40bc60d6ae
2
NEWS
2
NEWS
|
@ -10,6 +10,8 @@ ver 0.23.9 (not yet released)
|
||||||
* fix bogus volume levels with multiple partitions
|
* fix bogus volume levels with multiple partitions
|
||||||
* improve iconv detection
|
* improve iconv detection
|
||||||
* macOS: fix macOS 10 build problem (0.23.8 regression)
|
* macOS: fix macOS 10 build problem (0.23.8 regression)
|
||||||
|
* Android
|
||||||
|
- load mpd.conf from app data directory
|
||||||
|
|
||||||
ver 0.23.8 (2022/07/09)
|
ver 0.23.8 (2022/07/09)
|
||||||
* storage
|
* storage
|
||||||
|
|
|
@ -36,7 +36,9 @@ Installing on Android
|
||||||
|
|
||||||
An experimental Android build is available on Google Play. After installing and launching it, :program:`MPD` will scan the music in your Music directory and you can control it as usual with a :program:`MPD` client.
|
An experimental Android build is available on Google Play. After installing and launching it, :program:`MPD` will scan the music in your Music directory and you can control it as usual with a :program:`MPD` client.
|
||||||
|
|
||||||
If you need to tweak the configuration, you can create a file called :file:`mpd.conf` on the data partition (the directory which is returned by Android's :dfn:`getExternalStorageDirectory()` API function).
|
If you need to tweak the configuration, you can create a file called
|
||||||
|
:file:`mpd.conf` in MPD's data directory on the external storage
|
||||||
|
(usually :file:`Android/data/org.musicpd/files/mpd.conf`).
|
||||||
|
|
||||||
ALSA is not available on Android; only the :ref:`OpenSL ES
|
ALSA is not available on Android; only the :ref:`OpenSL ES
|
||||||
<sles_output>` output plugin can be used for local playback.
|
<sles_output>` output plugin can be used for local playback.
|
||||||
|
|
11
src/Main.cxx
11
src/Main.cxx
|
@ -607,6 +607,17 @@ TryReadConfigFile(ConfigData &config, Path path)
|
||||||
static void
|
static void
|
||||||
LoadConfigFile(JNIEnv *env, ConfigData &config)
|
LoadConfigFile(JNIEnv *env, ConfigData &config)
|
||||||
{
|
{
|
||||||
|
/* try loading mpd.conf from
|
||||||
|
"Android/data/org.musicpd/files/mpd.conf" (the app specific
|
||||||
|
data directory) first */
|
||||||
|
if (const auto dir = context->GetExternalFilesDir(env);
|
||||||
|
!dir.IsNull() &&
|
||||||
|
TryReadConfigFile(config, dir / Path::FromFS("mpd.conf")))
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* if that fails, attempt to load "mpd.conf" from the root of
|
||||||
|
the SD card (pre-0.23.9, ceases to work since Android
|
||||||
|
12) */
|
||||||
if (const auto dir = Environment::getExternalStorageDirectory(env);
|
if (const auto dir = Environment::getExternalStorageDirectory(env);
|
||||||
!dir.IsNull())
|
!dir.IsNull())
|
||||||
TryReadConfigFile(config, dir / Path::FromFS("mpd.conf"));
|
TryReadConfigFile(config, dir / Path::FromFS("mpd.conf"));
|
||||||
|
|
Loading…
Reference in New Issue