Browse Source

Android : added TEMP env var pointing to a tmp dir in internan cache

JNI-44
Edouard Tisserant 10 years ago
parent
commit
e8fe8e5d25
  1. 1
      android/build.gradle
  2. 14
      android/src/org/pEp/jniadapter/AndroidHelper.java

1
android/build.gradle

@ -120,6 +120,7 @@ android {
// call regular ndk-build(.cmd) script from app directory
task jniBuild(type: Exec) {
// In case ndk-gdb works one day, add: 'NDK_DEBUG=1',
commandLine getNdkBuildCmd(), 'V=1', 'GPGBUILD='+externalInstallDir.absolutePath
}
jniBuild.dependsOn genSources

14
android/src/org/pEp/jniadapter/AndroidHelper.java

@ -34,6 +34,7 @@ public class AndroidHelper {
private static File optDir;
private static File versionFile;
public static File binDir;
private static File tmpDir;
// TODO : Increment when needed.
public static int VERSION_CODE = 0;
@ -61,6 +62,9 @@ public class AndroidHelper {
setenv("PATH", System.getenv("PATH") + ":" +
binDir.getAbsolutePath(), true);
tmpDir = new File(c.getCacheDir(), "tmp");
setenv("TEMP", tmpDir.getAbsolutePath(), true);
// Tell dynamic loader where to find libs
String appLibDir = "";
try {
@ -126,9 +130,17 @@ public class AndroidHelper {
// Fill version file
setInstalledVersion(c);
// Clean and creat tempdir
if (tmpDir.exists()){
try {
FileUtils.deleteDirectory(tmpDir);
} catch (IOException e) {
Log.e(TAG, "Couldn't delete temp dir");
}
}
optDir.mkdirs();
}
public static void nativeSetup(Context c) {
// pre-load libs for pepengine, as
// android cannot solve lib dependencies on its own

Loading…
Cancel
Save