mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2025-05-11 13:05:37 +02:00
fix: Move temporary files outside of the cache directory (#2193)
Co-authored-by: Pun Butrach <pun.butrach@gmail.com>
This commit is contained in:
parent
d688f38a63
commit
1ef1f8d47a
3 changed files with 13 additions and 1 deletions
|
@ -34,7 +34,7 @@ class PatcherAPI {
|
|||
Future<void> initialize() async {
|
||||
await loadPatches();
|
||||
await _managerAPI.downloadIntegrations();
|
||||
final Directory appCache = await getTemporaryDirectory();
|
||||
final Directory appCache = await getApplicationSupportDirectory();
|
||||
_dataDir = await getExternalStorageDirectory() ?? appCache;
|
||||
_tmpDir = Directory('${appCache.path}/patcher');
|
||||
_keyStoreFile = File('${_dataDir.path}/revanced-manager.keystore');
|
||||
|
@ -151,6 +151,7 @@ class PatcherAPI {
|
|||
String packageName,
|
||||
String apkFilePath,
|
||||
List<Patch> selectedPatches,
|
||||
bool isFromStorage,
|
||||
) async {
|
||||
final File? integrationsFile = await _managerAPI.downloadIntegrations();
|
||||
final Map<String, Map<String, dynamic>> options = {};
|
||||
|
@ -176,6 +177,13 @@ class PatcherAPI {
|
|||
final File inApkFile = File('${workDir.path}/in.apk');
|
||||
await File(apkFilePath).copy(inApkFile.path);
|
||||
|
||||
if (isFromStorage) {
|
||||
// The selected apk was copied to cacheDir by the file picker, so it's not needed anymore.
|
||||
// rename() can't be used here, as Android system also counts the size of files moved out from cacheDir
|
||||
// as part of the app's cache size.
|
||||
File(apkFilePath).delete();
|
||||
}
|
||||
|
||||
outFile = File('${workDir.path}/out.apk');
|
||||
|
||||
final Directory tmpDir =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue