From e46ad3595d0d3cfb5519a88466177727df677b0f Mon Sep 17 00:00:00 2001 From: aliernfrog <45766489+aliernfrog@users.noreply.github.com> Date: Sun, 9 Oct 2022 21:35:43 +0300 Subject: [PATCH] fix: permanent keystore path if available (#375) --- lib/services/patcher_api.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/services/patcher_api.dart b/lib/services/patcher_api.dart index f70d6a1b21..44ce885941 100644 --- a/lib/services/patcher_api.dart +++ b/lib/services/patcher_api.dart @@ -18,6 +18,7 @@ class PatcherAPI { MethodChannel('app.revanced.manager.flutter/patcher'); final ManagerAPI _managerAPI = locator(); final RootAPI _rootAPI = RootAPI(); + late Directory _dataDir; late Directory _tmpDir; late File _keyStoreFile; List _patches = []; @@ -26,8 +27,9 @@ class PatcherAPI { Future initialize() async { await _loadPatches(); Directory appCache = await getTemporaryDirectory(); + _dataDir = await getExternalStorageDirectory() ?? appCache; _tmpDir = Directory('${appCache.path}/patcher'); - _keyStoreFile = File('${appCache.path}/revanced-manager.keystore'); + _keyStoreFile = File('${_dataDir.path}/revanced-manager.keystore'); cleanPatcher(); } @@ -163,6 +165,7 @@ class PatcherAPI { integrationsFile = await _managerAPI.downloadIntegrations(); } if (patchBundleFile != null) { + _dataDir.createSync(); _tmpDir.createSync(); Directory workDir = _tmpDir.createTempSync('tmp-'); File inputFile = File('${workDir.path}/base.apk');