JNI mkdirs

This commit is contained in:
M66B 2023-12-12 21:19:40 +01:00
parent d56b5fa43e
commit 9f1bab8e19
3 changed files with 13 additions and 2 deletions

View File

@ -2645,7 +2645,7 @@ public class Helper {
parent.mkdir();
File dir = new File(parent, subdir);
dir.mkdir();
Log.jni_safe_mkdirs(dir);
synchronized (exists) {
if (exists.containsKey(dir))

View File

@ -245,6 +245,8 @@ public class Log {
public static native void jni_safe_write(OutputStream os, byte[] data);
public static native boolean jni_safe_mkdirs(File file);
public static native long[] jni_safe_runtime_stats();
public static void setLevel(Context context) {
@ -403,7 +405,6 @@ public class Log {
return t.toSafeString() + "\n" + t.getSafeStackTraceString();
}
public static void persist(EntityLog.Type type, String message) {
if (ctx == null)
Log.e(message);
@ -1932,6 +1933,8 @@ public class Log {
db.endTransaction();
}
Log.jni_safe_mkdirs(new File(context.getFilesDir(), "testing"));
ServiceSynchronize.eval(context, "debuginfo");
return draft;

View File

@ -74,6 +74,14 @@ Java_eu_faircode_email_Log_jni_1safe_1write(JNIEnv *env, jclass clazz,
env->CallVoidMethod(os, mid, data);
}
extern "C"
JNIEXPORT jboolean JNICALL
Java_eu_faircode_email_Log_jni_1safe_1mkdirs(JNIEnv *env, jclass clazz, jobject file) {
jclass cls = env->FindClass("java/io/File");
jmethodID mid = env->GetMethodID(cls, "mkdirs", "()Z");
return (jboolean) env->CallBooleanMethod(file, mid);
}
extern "C"
JNIEXPORT jlongArray JNICALL
Java_eu_faircode_email_Log_jni_1safe_1runtime_1stats(JNIEnv *env, jclass clazz) {