From 5cd1cba6685f5c981ca1435885c60fddb53bbcaa Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sat, 9 Mar 2024 10:01:36 +0100 Subject: [PATCH] fix: Copy APK to working directory before trying to write to it --- lib/services/patcher_api.dart | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/services/patcher_api.dart b/lib/services/patcher_api.dart index c65cd630..294d6fef 100644 --- a/lib/services/patcher_api.dart +++ b/lib/services/patcher_api.dart @@ -171,7 +171,10 @@ class PatcherAPI { if (integrationsFile != null) { _dataDir.createSync(); _tmpDir.createSync(); - final Directory workDir = _tmpDir.createTempSync('tmp-'); + final Directory workDir = await _tmpDir.createTemp('tmp-'); + + final File inApkFile = File('${workDir.path}/in.apk'); + await File(apkFilePath).copy(inApkFile.path); outFile = File('${workDir.path}/out.apk'); @@ -182,7 +185,7 @@ class PatcherAPI { await patcherChannel.invokeMethod( 'runPatcher', { - 'inFilePath': apkFilePath, + 'inFilePath': inApkFile.path, 'outFilePath': outFile!.path, 'integrationsPath': integrationsFile.path, 'selectedPatches': selectedPatches.map((p) => p.name).toList(),