Skip to content

Commit

Permalink
feat: delete cache if patching fails
Browse files Browse the repository at this point in the history
  • Loading branch information
rushiiMachine committed May 19, 2024
1 parent f51e9bb commit 45d9b0a
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.Context
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.ProcessLifecycleOwner
import com.aliucord.manager.R
import com.aliucord.manager.installer.steps.base.DownloadStep
import com.aliucord.manager.installer.steps.base.Step
import com.aliucord.manager.manager.PreferencesManager
import com.aliucord.manager.ui.util.InstallNotifications
Expand Down Expand Up @@ -50,6 +51,14 @@ abstract class StepRunner : KoinComponent {
val error = step.executeCatching(this@StepRunner)
if (error != null) {
showErrorNotification()

// If this is a patch step and it failed, then clear download cache just in case
if (step.group == StepGroup.Patch && !preferences.devMode) {
for (downloadStep in steps.asSequence().filterIsInstance<DownloadStep>()) {
downloadStep.targetFile.delete()
}
}

return error
}

Expand Down

0 comments on commit 45d9b0a

Please sign in to comment.