Skip to content

Commit

Permalink
fix: Empty “tmp-XXXXXX” directory keeps growing in cacheDir (#2194)
Browse files Browse the repository at this point in the history
  • Loading branch information
kitadai31 committed Sep 7, 2024
1 parent 09fd9c4 commit f5a12e0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,13 @@ class MainActivity : FlutterActivity() {

"getPatches" -> {
val patchBundleFilePath = call.argument<String>("patchBundleFilePath")!!
val cacheDirPath = call.argument<String>("cacheDirPath")!!

try {
val patchBundleFile = File(patchBundleFilePath)
patchBundleFile.setWritable(false)
patches = PatchBundleLoader.Dex(
patchBundleFile,
optimizedDexDirectory = File(cacheDirPath)
optimizedDexDirectory = codeCacheDir
)
} catch (ex: Exception) {
return@setMethodCallHandler result.notImplemented()
Expand Down
7 changes: 0 additions & 7 deletions lib/services/manager_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -427,19 +427,12 @@ class ManagerAPI {
return patches;
}
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) {
try {
final String patchesJson = await PatcherAPI.patcherChannel.invokeMethod(
'getPatches',
{
'patchBundleFilePath': patchBundleFile.path,
'cacheDirPath': cacheDir.path,
},
);
final List<dynamic> patchesJsonList = jsonDecode(patchesJson);
Expand Down

0 comments on commit f5a12e0

Please sign in to comment.