fix: ensure directory exists when listing custom component files
This commit is contained in:
parent
96a463349c
commit
f3547048e3
3 changed files with 8 additions and 4 deletions
|
|
@ -107,8 +107,12 @@ class PathManager(
|
|||
/**
|
||||
* List all the files that follow the ```[SemVer].custom.*``` naming scheme.
|
||||
*/
|
||||
private fun listCustomFiles(dir: File): List<SemVer> {
|
||||
val files = dir.listFiles() ?: return emptyList()
|
||||
private fun listCustomFiles(dir: File): List<SemVer>? {
|
||||
if (!dir.exists()) return null
|
||||
|
||||
val files = dir.listFiles()
|
||||
?: throw Error("Failed to list directory")
|
||||
|
||||
val customVersions = files
|
||||
.map { it.nameWithoutExtension }
|
||||
.filter { it.endsWith(".custom") }
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class DownloadInjectorStep : DownloadStep(), IDexProvider, KoinComponent {
|
|||
|
||||
override suspend fun execute(container: StepRunner) {
|
||||
val customVersions = mutableStateListOf<SemVer>()
|
||||
.apply { addAll(paths.customInjectorDexs()) }
|
||||
customVersions += paths.customInjectorDexs() ?: emptyList()
|
||||
|
||||
// Prompt to select or manage custom versions instead of downloading
|
||||
if (customVersions.isNotEmpty()) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class DownloadPatchesStep : DownloadStep(), KoinComponent {
|
|||
|
||||
override suspend fun execute(container: StepRunner) {
|
||||
val customVersions = mutableStateListOf<SemVer>()
|
||||
.apply { addAll(paths.customSmaliPatches()) }
|
||||
customVersions += paths.customSmaliPatches() ?: emptyList()
|
||||
|
||||
// Prompt to select or manage custom versions instead of downloading
|
||||
if (customVersions.isNotEmpty()) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue