Use the same cacheDir to reuse cache

This commit is contained in:
Mygod
2020-07-07 06:45:52 +08:00
parent 90f49b3159
commit d2f9f592a5

View File

@@ -329,12 +329,8 @@ object TetheringManager {
} catch (e: InvocationTargetException) {
if (e.targetException is SecurityException) GlobalScope.launch(Dispatchers.Unconfined) {
val result = try {
val rootCache = File(cacheDir, "root")
rootCache.mkdirs()
check(rootCache.exists()) { "Creating root cache dir failed" }
RootManager.use {
it.execute(be.mygod.vpnhotspot.root.StartTetheringLegacy(
rootCache, type, showProvisioningUi))
it.execute(be.mygod.vpnhotspot.root.StartTetheringLegacy(cacheDir, type, showProvisioningUi))
}.value
} catch (eRoot: Exception) {
eRoot.addSuppressed(e)