From 9760a98d955f18204c17ff30522d5e2be5ef0cd6 Mon Sep 17 00:00:00 2001 From: Graham Date: Sat, 11 Apr 2020 12:03:56 +0100 Subject: [PATCH] Compile regex in DecompileCommand once Signed-off-by: Graham --- .../main/java/dev/openrs2/decompiler/DecompileCommand.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/decompiler/src/main/java/dev/openrs2/decompiler/DecompileCommand.kt b/decompiler/src/main/java/dev/openrs2/decompiler/DecompileCommand.kt index d9141a4cb5..db0c2587ce 100644 --- a/decompiler/src/main/java/dev/openrs2/decompiler/DecompileCommand.kt +++ b/decompiler/src/main/java/dev/openrs2/decompiler/DecompileCommand.kt @@ -23,11 +23,15 @@ class DecompileCommand : CliktCommand(name = "decompile") { } private fun getDestination(archive: String): Path { - var dir = archive.replace(Regex("(?:_gl)?[.]jar$"), "") + var dir = archive.replace(JAR_SUFFIX_REGEX, "") when (dir) { "runescape" -> dir = "client" "jaggl" -> dir = "gl" } return Paths.get("nonfree").resolve(dir).resolve("src/main/java") } + + companion object { + private val JAR_SUFFIX_REGEX = Regex("(?:_gl)?[.]jar$") + } }