fix: Copy APK to working directory before trying to write to it

This commit is contained in:
oSumAtrIX 2024-03-09 10:01:36 +01:00
parent ca365bac6e
commit 5cd1cba668
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -171,7 +171,10 @@ class PatcherAPI {
if (integrationsFile != null) { if (integrationsFile != null) {
_dataDir.createSync(); _dataDir.createSync();
_tmpDir.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'); outFile = File('${workDir.path}/out.apk');
@ -182,7 +185,7 @@ class PatcherAPI {
await patcherChannel.invokeMethod( await patcherChannel.invokeMethod(
'runPatcher', 'runPatcher',
{ {
'inFilePath': apkFilePath, 'inFilePath': inApkFile.path,
'outFilePath': outFile!.path, 'outFilePath': outFile!.path,
'integrationsPath': integrationsFile.path, 'integrationsPath': integrationsFile.path,
'selectedPatches': selectedPatches.map((p) => p.name).toList(), 'selectedPatches': selectedPatches.map((p) => p.name).toList(),