Skip to content

Commit

Permalink
requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
QuackingCanary committed Feb 27, 2024
1 parent 1e32790 commit 36c1ecf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/org/stratoemu/strato/AppDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class AppDialog : BottomSheetDialogFragment() {
}.show()
}

val cacheExists = CacheManagementUtils.pipelineCacheExists(item.titleId)
val cacheExists = CacheManagementUtils.pipelineCacheExists(item.titleId!!)

binding.cacheDelete.isEnabled = cacheExists
binding.cacheDelete.setOnClickListener {
Expand All @@ -146,7 +146,7 @@ class AppDialog : BottomSheetDialogFragment() {
.setMessage(getString(R.string.action_irreversible))
.setNegativeButton(getString(R.string.no), null)
.setPositiveButton(getString(R.string.yes)) { _, _ ->
if(CacheManagementUtils.deleteCacheFile(item.titleId)) {
if(CacheManagementUtils.deleteCacheFile(item.titleId!!)) {
binding.cacheDelete.isEnabled = false
}
}.show()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ class CacheManagementUtils {
companion object {
private val cacheFolderRoot by lazy { "${StratoApplication.instance.getPublicFilesDir().canonicalPath}/graphics_pipeline_cache/" }

/**
* Check if files are existing
*/
fun pipelineCacheExists(titleId: String?) : Boolean {
fun pipelineCacheExists(titleId: String) : Boolean {
val cacheFolderPath = cacheFolderRoot + titleId
val cacheFolderPathExt = "$cacheFolderRoot$titleId.staging"

Expand All @@ -27,10 +24,9 @@ class CacheManagementUtils {
/**
* Deletes the cache files for a given game.
*/
fun deleteCacheFile(titleId : String?) : Boolean {
if (titleId == null) return false
fun deleteCacheFile(titleId : String) : Boolean {
return File("${cacheFolderRoot}$titleId").delete()
&& File("${cacheFolderRoot}$titleId.staging").delete()
}
}
}
}
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@
<string name="save_data_found">Save data found. What would you like to do?</string>
<string name="save_data_not_found">No save data found. What would you like to do?</string>
<string name="delete_save_confirmation_message">Are you sure you want to delete this save?</string>
<string name="delete_shader_cache_confirmation_message">Are you sure you want to clear shader cache?</string>
<string name="delete_shader_cache_confirmation_message">Are you sure you want to delete all cached shaders?</string>
<string name="manage_shader_cache">Manage shader cache</string>
<string name="clear_shader_cache">Clear shader cache</string>
<string name="action_irreversible">This action is irreversible</string>
Expand Down

0 comments on commit 36c1ecf

Please sign in to comment.