@@ -105,17 +105,17 @@ object MainGenericRunner {
105105 case " -run" :: fqName :: tail =>
106106 process(tail, settings.withExecuteMode(ExecuteMode .Run ).withTargetToRun(fqName))
107107 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
109110 (tail, cp)
110111 else
111112 // combine globbed classpath entries into a classpath
112- val globdir = cp.replaceAll(" [\\ /][^\\ /]*$" ," " ) // must be forward-backward-slash-agnostic
113113 val jarfiles = cp :: tail
114114 val cpfiles = jarfiles.takeWhile( f => f.startsWith(globdir) && ((f.toLowerCase.endsWith(" .jar" ) || f.endsWith(" .zip" ))) )
115115 val tailargs = jarfiles.drop(cpfiles.size)
116116 (tailargs, cpfiles.mkString(classpathSeparator))
117117
118- process(tailargs, settings.copy(classPath = settings.classPath.appended(cpstr )))
118+ process(tailargs, settings.copy(classPath = settings.classPath ++ cpstr.split(classpathSeparator).filter(_.nonEmpty )))
119119
120120 case (" -version" | " --version" ) :: _ =>
121121 settings.copy(
@@ -201,7 +201,6 @@ object MainGenericRunner {
201201 }
202202 errorFn(" " , res)
203203 case ExecuteMode .Script =>
204- val targetScriptPath : String = settings.targetScript.toString.replace('\\ ' , '/' )
205204 val properArgs =
206205 List (" -classpath" , settings.classPath.mkString(classpathSeparator)).filter(Function .const(settings.classPath.nonEmpty))
207206 ++ settings.residualArgs
0 commit comments