Compile regex in DecompileCommand once

Signed-off-by: Graham <gpe@openrs2.dev>
Graham 5 years ago
parent 4f48a59ee3
commit 9760a98d95
  1. 6
      decompiler/src/main/java/dev/openrs2/decompiler/DecompileCommand.kt

@ -23,11 +23,15 @@ class DecompileCommand : CliktCommand(name = "decompile") {
} }
private fun getDestination(archive: String): Path { private fun getDestination(archive: String): Path {
var dir = archive.replace(Regex("(?:_gl)?[.]jar$"), "") var dir = archive.replace(JAR_SUFFIX_REGEX, "")
when (dir) { when (dir) {
"runescape" -> dir = "client" "runescape" -> dir = "client"
"jaggl" -> dir = "gl" "jaggl" -> dir = "gl"
} }
return Paths.get("nonfree").resolve(dir).resolve("src/main/java") return Paths.get("nonfree").resolve(dir).resolve("src/main/java")
} }
companion object {
private val JAR_SUFFIX_REGEX = Regex("(?:_gl)?[.]jar$")
}
} }

Loading…
Cancel
Save