@@ -105,17 +105,17 @@ object MainGenericRunner {
105
105
case " -run" :: fqName :: tail =>
106
106
process(tail, settings.withExecuteMode(ExecuteMode .Run ).withTargetToRun(fqName))
107
107
case (" -cp" | " -classpath" | " --class-path" ) :: cp :: tail =>
108
- val (tailargs, cpstr) = if classpathSeparator != " ;" || cp.contains(classpathSeparator) then
108
+ val globdir = cp.replaceAll(" [\\ /][^\\ /]*$" ," " ) // slash/backslash agnostic
109
+ val (tailargs, cpstr) = if globdir.nonEmpty && classpathSeparator != " ;" || cp.contains(classpathSeparator) then
109
110
(tail, cp)
110
111
else
111
112
// combine globbed classpath entries into a classpath
112
- val globdir = cp.replaceAll(" [\\ /][^\\ /]*$" ," " ) // must be forward-backward-slash-agnostic
113
113
val jarfiles = cp :: tail
114
114
val cpfiles = jarfiles.takeWhile( f => f.startsWith(globdir) && ((f.toLowerCase.endsWith(" .jar" ) || f.endsWith(" .zip" ))) )
115
115
val tailargs = jarfiles.drop(cpfiles.size)
116
116
(tailargs, cpfiles.mkString(classpathSeparator))
117
117
118
- process(tailargs, settings.copy(classPath = settings.classPath.appended(cpstr )))
118
+ process(tailargs, settings.copy(classPath = settings.classPath ++ cpstr.split(classpathSeparator).filter(_.nonEmpty )))
119
119
120
120
case (" -version" | " --version" ) :: _ =>
121
121
settings.copy(
@@ -201,7 +201,6 @@ object MainGenericRunner {
201
201
}
202
202
errorFn(" " , res)
203
203
case ExecuteMode .Script =>
204
- val targetScriptPath : String = settings.targetScript.toString.replace('\\ ' , '/' )
205
204
val properArgs =
206
205
List (" -classpath" , settings.classPath.mkString(classpathSeparator)).filter(Function .const(settings.classPath.nonEmpty))
207
206
++ settings.residualArgs
0 commit comments