Fix pottentially improper unpacking

This commit is contained in:
Boulay Mathias 2022-05-15 19:23:32 +02:00
parent e4dac248e0
commit 12510ca242
3 changed files with 4 additions and 3 deletions

View File

@ -224,7 +224,7 @@ public abstract class BaseLauncherActivity extends BaseActivity {
Thread t = new Thread(() -> {
try {
String name = getFileName(this, uri);
MultiRTUtils.installRuntimeNamed(getContentResolver().openInputStream(uri), name,
MultiRTUtils.installRuntimeNamed(getApplicationContext().getApplicationInfo().nativeLibraryDir, getContentResolver().openInputStream(uri), name,
(resid, stuff) -> BaseLauncherActivity.this.runOnUiThread(
() -> barrier.setMessage(BaseLauncherActivity.this.getString(resid, stuff))));
MultiRTUtils.postPrepare(BaseLauncherActivity.this, name);

View File

@ -389,7 +389,7 @@ public class PojavLoginActivity extends BaseActivity {
final Uri uri = data.getData();
Thread t = new Thread(() -> {
try {
MultiRTUtils.installRuntimeNamed(getContentResolver().openInputStream(uri), getFileName(this, uri),
MultiRTUtils.installRuntimeNamed(getApplicationContext().getApplicationInfo().nativeLibraryDir, getContentResolver().openInputStream(uri), getFileName(this, uri),
(resid, stuff) -> PojavLoginActivity.this.runOnUiThread(
() -> {
if (startupTextView != null)

View File

@ -75,7 +75,7 @@ public class MultiRTUtils {
return result;
}
public static void installRuntimeNamed(InputStream runtimeInputStream, String name, RuntimeProgressReporter progressReporter) throws IOException {
public static void installRuntimeNamed(String nativeLibDir, InputStream runtimeInputStream, String name, RuntimeProgressReporter progressReporter) throws IOException {
File dest = new File(RUNTIME_FOLDER,"/"+name);
File tmp = new File(dest,"temporary");
if(dest.exists()) FileUtils.deleteDirectory(dest);
@ -87,6 +87,7 @@ public class MultiRTUtils {
runtimeInputStream.close();
uncompressTarXZ(tmp,dest,progressReporter);
tmp.delete();
unpack200(nativeLibDir,RUNTIME_FOLDER + "/" + name);
read(name);
}