Skip to content
Permalink
Browse files

Optimize file handling

  • Loading branch information...
rekire committed May 17, 2019
1 parent 877ba85 commit 934b5e438cd0b08a72c944df80c357931354d2c3
Showing with 4 additions and 3 deletions.
  1. +4 −3 cli/src/main/kotlin/org/rewedigital/konversation/Cli.kt
@@ -38,12 +38,13 @@ open class Cli {
var argNo = 0
while (argNo < args.size) {
val arg = args[argNo]
if (File(arg).absoluteFile.exists()) {
val argFile = File(arg)
if (argFile.absoluteFile.exists()) {
inputFiles += File(arg).absoluteFile
} else if (arg.endsWith(".kvs") || arg.endsWith(".grammar") || arg.endsWith(".values")) {
if (arg.contains('*')) {
val matcher = arg.substringAfterLast('\\').substringAfterLast('/').replace(".", "\\.").replace("*", ".*?").toRegex()
File(arg).parentFile.listFiles { _, name ->
val matcher = argFile.name.replace(".", "\\.").replace("*", ".*?").toRegex()
argFile.parentFile.listFiles { _, name ->
matcher.matches(name)
}.map { file ->
inputFiles += file.absoluteFile

0 comments on commit 934b5e4

Please sign in to comment.
You can’t perform that action at this time.