Commit 77782102 authored by Max Kellermann's avatar Max Kellermann

Main: move code to TryReadConfigFile()

parent 6229210d
......@@ -590,16 +590,26 @@ MainConfigured(const CommandLineOptions &options,
#ifdef ANDROID
/**
* Wrapper for ReadConfigFile() which returns false if the file was
* not found.
*/
static bool
TryReadConfigFile(ConfigData &config, Path path)
{
if (!FileExists(path))
return false;
ReadConfigFile(config, path);
return true;
}
static void
LoadConfigFile(JNIEnv *env, ConfigData &config)
{
if (const auto dir = Environment::getExternalStorageDirectory(env);
!dir.IsNull()) {
const auto config_path =
dir / Path::FromFS("mpd.conf");
if (FileExists(config_path))
ReadConfigFile(config, config_path);
}
!dir.IsNull())
TryReadConfigFile(config, dir / Path::FromFS("mpd.conf"));
}
static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment