Skip to content

Commit

Permalink
account for incorrect casing for creations
Browse files Browse the repository at this point in the history
  • Loading branch information
ManApart committed Jun 26, 2024
1 parent 303725c commit e6df1f3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/main/kotlin/commands/Creation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import red
import save
import toolConfig
import toolData
import verbose
import yellow
import java.io.File
import java.nio.file.Files
Expand Down Expand Up @@ -145,9 +146,17 @@ fun addCreation(creation: Creation) {
}
}

val dataFolderFiles = File(toolConfig.gamePath!! + "/Data").listFiles()!!
val dest = File(mod.filePath + "/Data").also { it.mkdirs() }
files.forEach { file ->
if (!file.exists()) {
files.forEach { initialFile ->
var file: File? = initialFile
//Catalog can have incorrect file casing, so we should perform a backup search
if (!initialFile.exists()) {
val search = initialFile.name.lowercase()
file = dataFolderFiles.firstOrNull { it.name.lowercase() == search }
}
if (file == null || !file.exists()) {
verbose(red(initialFile.absolutePath + " does not exist"))
println(red("Unable to find creation files in data. Are you sure it's properly downloaded?"))
rmCreation(mod, true)
return
Expand Down

0 comments on commit e6df1f3

Please sign in to comment.