aboutsummaryrefslogtreecommitdiffstats
path: root/src/Main.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-03-01 20:20:29 +0100
committerMax Kellermann <max@duempel.org>2014-03-01 22:20:28 +0100
commitb8f1850bba98685e978025041e495198627b57f5 (patch)
treea406368074249d77e84572a4f228ea1fcfd19104 /src/Main.cxx
parent5268f55344229f70e3565f63671eb582eaff733f (diff)
downloadmpd-b8f1850bba98685e978025041e495198627b57f5.tar.gz
mpd-b8f1850bba98685e978025041e495198627b57f5.tar.xz
mpd-b8f1850bba98685e978025041e495198627b57f5.zip
db/Configured: store database file in cache directory
Add class Context which wraps the Android/Java Context class and add a JNI wrapper for method Context.getCacheDir().
Diffstat (limited to 'src/Main.cxx')
-rw-r--r--src/Main.cxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Main.cxx b/src/Main.cxx
index f54638170..165e53fd7 100644
--- a/src/Main.cxx
+++ b/src/Main.cxx
@@ -93,6 +93,7 @@
#include "java/Global.hxx"
#include "java/File.hxx"
#include "android/Environment.hxx"
+#include "android/Context.hxx"
#include "org_musicpd_Bridge.h"
#endif
@@ -118,6 +119,10 @@ static constexpr unsigned DEFAULT_BUFFER_BEFORE_PLAY = 10;
static constexpr Domain main_domain("main");
+#ifdef ANDROID
+Context *context;
+#endif
+
Instance *instance;
static StateFile *state_file;
@@ -679,14 +684,17 @@ int mpd_main(int argc, char *argv[])
gcc_visibility_default
JNIEXPORT void JNICALL
-Java_org_musicpd_Bridge_run(JNIEnv *env, jclass)
+Java_org_musicpd_Bridge_run(JNIEnv *env, jclass, jobject _context)
{
Java::Init(env);
Java::File::Initialise(env);
Environment::Initialise(env);
+ context = new Context(env, _context);
+
mpd_main(0, nullptr);
+ delete context;
Environment::Deinitialise(env);
}