mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2024-11-10 01:01:56 +01:00
fix: Empty “tmp-XXXXXX” directory keeps growing in cacheDir (#2194)
This commit is contained in:
parent
09fd9c4e04
commit
f5a12e01bd
2 changed files with 1 additions and 9 deletions
|
@ -109,14 +109,13 @@ class MainActivity : FlutterActivity() {
|
||||||
|
|
||||||
"getPatches" -> {
|
"getPatches" -> {
|
||||||
val patchBundleFilePath = call.argument<String>("patchBundleFilePath")!!
|
val patchBundleFilePath = call.argument<String>("patchBundleFilePath")!!
|
||||||
val cacheDirPath = call.argument<String>("cacheDirPath")!!
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
val patchBundleFile = File(patchBundleFilePath)
|
val patchBundleFile = File(patchBundleFilePath)
|
||||||
patchBundleFile.setWritable(false)
|
patchBundleFile.setWritable(false)
|
||||||
patches = PatchBundleLoader.Dex(
|
patches = PatchBundleLoader.Dex(
|
||||||
patchBundleFile,
|
patchBundleFile,
|
||||||
optimizedDexDirectory = File(cacheDirPath)
|
optimizedDexDirectory = codeCacheDir
|
||||||
)
|
)
|
||||||
} catch (ex: Exception) {
|
} catch (ex: Exception) {
|
||||||
return@setMethodCallHandler result.notImplemented()
|
return@setMethodCallHandler result.notImplemented()
|
||||||
|
|
|
@ -427,19 +427,12 @@ class ManagerAPI {
|
||||||
return patches;
|
return patches;
|
||||||
}
|
}
|
||||||
final File? patchBundleFile = await downloadPatches();
|
final File? patchBundleFile = await downloadPatches();
|
||||||
final Directory appCache = await getTemporaryDirectory();
|
|
||||||
Directory('${appCache.path}/cache').createSync();
|
|
||||||
final Directory workDir =
|
|
||||||
Directory('${appCache.path}/cache').createTempSync('tmp-');
|
|
||||||
final Directory cacheDir = Directory('${workDir.path}/cache');
|
|
||||||
cacheDir.createSync();
|
|
||||||
if (patchBundleFile != null) {
|
if (patchBundleFile != null) {
|
||||||
try {
|
try {
|
||||||
final String patchesJson = await PatcherAPI.patcherChannel.invokeMethod(
|
final String patchesJson = await PatcherAPI.patcherChannel.invokeMethod(
|
||||||
'getPatches',
|
'getPatches',
|
||||||
{
|
{
|
||||||
'patchBundleFilePath': patchBundleFile.path,
|
'patchBundleFilePath': patchBundleFile.path,
|
||||||
'cacheDirPath': cacheDir.path,
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
final List<dynamic> patchesJsonList = jsonDecode(patchesJson);
|
final List<dynamic> patchesJsonList = jsonDecode(patchesJson);
|
||||||
|
|
Loading…
Reference in a new issue