Skip to content

Commit 1d41f28

Browse files
committed
Fixed: Unable to run script with plus character in filename (fixes #144)
1 parent 257a21a commit 1d41f28

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/kotlin/kscript/app/Kscript.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,9 @@ fun main(args: Array<String>) {
181181
}
182182

183183
// Capitalize first letter and get rid of dashes (since this is what kotlin compiler is doing for the wrapper to create a valid java class name)
184+
// For valid characters see https://stackoverflow.com/questions/4814040/allowed-characters-in-filename
184185
val className = scriptFile.nameWithoutExtension
185-
.replace("[.-]".toRegex(), "_")
186+
.replace("[^A-Za-z0-9]".toRegex(), "_")
186187
.capitalize()
187188

188189

0 commit comments

Comments
 (0)