Skip to content

Commit b9557b0

Browse files
committed
remove unused code; reduce scope of when Windows classpath unglobbing occurs
1 parent a56c284 commit b9557b0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

compiler/src/dotty/tools/MainGenericRunner.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)