Index: libadblockplus-android/jni/JniJsEngine.cpp |
diff --git a/libadblockplus-android/jni/JniJsEngine.cpp b/libadblockplus-android/jni/JniJsEngine.cpp |
index e5b08d59fb90b39fb9f4cc5d49e2a56bad128f4b..6faa79eeaca583d14a74fc8ad59eb1a41e07fe97 100644 |
--- a/libadblockplus-android/jni/JniJsEngine.cpp |
+++ b/libadblockplus-android/jni/JniJsEngine.cpp |
@@ -40,7 +40,7 @@ static AdblockPlus::JsEngine& GetJsEngineRef(jlong ptr) |
} |
static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jobject jAppInfo, |
- jobject logSystem, jobject webRequest) |
+ jobject logSystem, jobject webRequest, jstring jBasePath) |
{ |
AdblockPlus::AppInfo appInfo; |
@@ -60,6 +60,13 @@ static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jobject jAppInfo, |
{ |
jniJsEngine->jsEngine->SetWebRequest(std::make_shared<JniWebRequest>(env, webRequest)); |
} |
+ if (jBasePath) |
+ { |
+ auto fileSystem = std::make_shared<AdblockPlus::DefaultFileSystemSync>(); |
+ std::string basePath = JniJavaToStdString(env, jBasePath); |
+ fileSystem->SetBasePath(basePath); |
+ jniJsEngine->jsEngine->SetFileSystem(fileSystem); |
+ } |
return JniPtrToLong(jniJsEngine); |
} |
@@ -144,22 +151,6 @@ static void JNICALL JniTriggerEvent(JNIEnv* env, jclass clazz, jlong ptr, jstrin |
CATCH_AND_THROW(env) |
} |
-static void JNICALL JniSetDefaultFileSystem(JNIEnv* env, jclass clazz, jlong ptr, jstring jBasePath) |
-{ |
- AdblockPlus::JsEngine& engine = GetJsEngineRef(ptr); |
- |
- try |
- { |
- auto fileSystem = std::make_shared<AdblockPlus::DefaultFileSystemSync>(); |
- |
- std::string basePath = JniJavaToStdString(env, jBasePath); |
- fileSystem->SetBasePath(basePath); |
- |
- engine.SetFileSystem(fileSystem); |
- } |
- CATCH_AND_THROW(env) |
-} |
- |
static jobject JNICALL JniNewLongValue(JNIEnv* env, jclass clazz, jlong ptr, jlong value) |
{ |
AdblockPlus::JsEngine& engine = GetJsEngineRef(ptr); |
@@ -202,7 +193,7 @@ static jobject JNICALL JniNewStringValue(JNIEnv* env, jclass clazz, jlong ptr, j |
static JNINativeMethod methods[] = |
{ |
- { (char*)"ctor", (char*)"(" TYP("AppInfo") TYP("LogSystem") TYP("WebRequest") ")J", (void*)JniCtor }, |
+ { (char*)"ctor", (char*)"(" TYP("AppInfo") TYP("LogSystem") TYP("WebRequest") "Ljava/lang/String;)J", (void*)JniCtor }, |
{ (char*)"dtor", (char*)"(J)V", (void*)JniDtor }, |
{ (char*)"setEventCallback", (char*)"(JLjava/lang/String;J)V", (void*)JniSetEventCallback }, |
@@ -211,8 +202,6 @@ static JNINativeMethod methods[] = |
{ (char*)"evaluate", (char*)"(JLjava/lang/String;Ljava/lang/String;)" TYP("JsValue"), (void*)JniEvaluate }, |
- { (char*)"setDefaultFileSystem", (char*)"(JLjava/lang/String;)V", (void*)JniSetDefaultFileSystem }, |
- |
{ (char*)"newValue", (char*)"(JJ)" TYP("JsValue"), (void*)JniNewLongValue }, |
{ (char*)"newValue", (char*)"(JZ)" TYP("JsValue"), (void*)JniNewBooleanValue }, |
{ (char*)"newValue", (char*)"(JLjava/lang/String;)" TYP("JsValue"), (void*)JniNewStringValue } |