From edc01f11bb1877abbdc42126930fb4e8f5c19c8d Mon Sep 17 00:00:00 2001 From: pelya Date: Wed, 28 Nov 2012 20:05:31 +0200 Subject: [PATCH] Saving shared libraries from assets to files dir instead of cache --- project/java/MainActivity.java | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/project/java/MainActivity.java b/project/java/MainActivity.java index 14d4a43f0..5d3375b0b 100644 --- a/project/java/MainActivity.java +++ b/project/java/MainActivity.java @@ -746,9 +746,9 @@ public class MainActivity extends Activity ZipInputStream zip = new ZipInputStream(in); - File cacheDir = getCacheDir(); + File libDir = getFilesDir(); try { - cacheDir.mkdirs(); + libDir.mkdirs(); } catch( SecurityException ee ) { }; byte[] buf = new byte[16384]; @@ -767,14 +767,14 @@ public class MainActivity extends Activity } if( entry.isDirectory() ) { - File outDir = new File( cacheDir.getAbsolutePath() + "/" + entry.getName() ); + File outDir = new File( libDir.getAbsolutePath() + "/" + entry.getName() ); if( !(outDir.exists() && outDir.isDirectory()) ) outDir.mkdirs(); continue; } OutputStream out = null; - String path = cacheDir.getAbsolutePath() + "/" + entry.getName(); + String path = libDir.getAbsolutePath() + "/" + entry.getName(); try { File outDir = new File( path.substring(0, path.lastIndexOf("/") )); if( !(outDir.exists() && outDir.isDirectory()) ) @@ -799,7 +799,7 @@ public class MainActivity extends Activity for(String l : Globals.AppLibraries) { String libname = System.mapLibraryName(l); - File libpath = new File(cacheDir, libname); + File libpath = new File(libDir, libname); System.out.println("libSDL: loading lib " + libpath.getPath()); System.load(libpath.getPath()); libpath.delete(); @@ -842,9 +842,9 @@ public class MainActivity extends Activity ZipInputStream zip = new ZipInputStream(in); - File cacheDir = getFilesDir(); + File libDir = getFilesDir(); try { - cacheDir.mkdirs(); + libDir.mkdirs(); } catch( SecurityException ee ) { }; byte[] buf = new byte[16384]; @@ -863,14 +863,14 @@ public class MainActivity extends Activity } if( entry.isDirectory() ) { - File outDir = new File( cacheDir.getAbsolutePath() + "/" + entry.getName() ); + File outDir = new File( libDir.getAbsolutePath() + "/" + entry.getName() ); if( !(outDir.exists() && outDir.isDirectory()) ) outDir.mkdirs(); continue; } OutputStream out = null; - String path = cacheDir.getAbsolutePath() + "/" + entry.getName(); + String path = libDir.getAbsolutePath() + "/" + entry.getName(); try { File outDir = new File( path.substring(0, path.lastIndexOf("/") )); if( !(outDir.exists() && outDir.isDirectory()) ) @@ -933,7 +933,7 @@ public class MainActivity extends Activity for(String l : libs) { String libname = System.mapLibraryName(l); - File libpath = new File(context.getCacheDir(), libname); + File libpath = new File(context.getFilesDir(), libname); System.out.println("libSDL: loading lib " + libpath.getPath()); System.load(libpath.getPath()); libpath.delete();