Skip to content
This repository was archived by the owner on Apr 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions app/src/main/java/net/rpcs3/ui/games/GamesScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ import net.rpcs3.ProgressRepository
import net.rpcs3.R
import net.rpcs3.RPCS3
import net.rpcs3.RPCS3Activity
import net.rpcs3.utils.FileUtil
import net.rpcs3.dialogs.AlertDialogQueue
import java.io.File
import kotlin.concurrent.thread
import kotlin.text.substringAfterLast

private fun withAlpha(color: Color, alpha: Float): Color {
return Color(
Expand Down Expand Up @@ -131,10 +133,17 @@ fun GameItem(game: Game) {
if (path.exists()) {
GameRepository.remove(game)
path.deleteRecursively()
if (!FileUtil.deleteCache(context, game.info.path.substringAfterLast("/"))) {
AlertDialogQueue.showDialog(
title = "Unexpected Error",
message = "Failed to delete game cache",
confirmText = "Close",
dismissText = ""
)
}
}

// FIXME: delete cache
})
}
)
}
}

Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/net/rpcs3/utils/FileUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ object FileUtil {
val paths = uri.pathSegments
return paths.size == 2 && "tree" == paths[0]
}

fun deleteCache(ctx: Context, gameId: String): Boolean {
return File(ctx.getExternalFilesDir(null)!!, "cache/cache/$gameId").deleteRecursively()
}
}

class SimpleDocument(val filename: String, val mimeType: String, val uri: Uri) {
Expand Down