This works in the emulator.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4223 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-03-15 21:58:21 +00:00
parent a5da17e1b1
commit 2ce2097a3f

View File

@ -36,14 +36,17 @@ public class MainActivity extends Activity {
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
web_view = (WebView)findViewById(R.id.web); web_view = (WebView)findViewById(R.id.web);
String arch = System.getProperty("os.arch");
Log.w("tildefriends", String.format("getFilesDir() is %s", getFilesDir().toString())); Log.w("tildefriends", String.format("getFilesDir() is %s", getFilesDir().toString()));
Log.w("tildefriends", String.format("getPackageResourcePath() is %s", getPackageResourcePath().toString())); Log.w("tildefriends", String.format("getPackageResourcePath() is %s", getPackageResourcePath().toString()));
Log.w("tildefriends", String.format("os.arch is %s", arch));
try { try {
ZipInputStream zip = new ZipInputStream(new BufferedInputStream(new FileInputStream(getPackageResourcePath().toString()))); ZipInputStream zip = new ZipInputStream(new BufferedInputStream(new FileInputStream(getPackageResourcePath().toString())));
ZipEntry entry = null; ZipEntry entry = null;
String lookup = String.format("lib/%s/tildefriends", arch);
while ((entry = zip.getNextEntry()) != null) { while ((entry = zip.getNextEntry()) != null) {
if (entry.getName().equals("lib/arm64-v8a/tildefriends")) { if (entry.getName().equals(lookup)) {
FileOutputStream out = new FileOutputStream(getFilesDir().toString().concat("/tildefriends")); FileOutputStream out = new FileOutputStream(getFilesDir().toString().concat("/tildefriends"));
byte[] buffer = new byte[32768]; byte[] buffer = new byte[32768];
int count; int count;