in src/scala/io/bazel/rules_scala/scrooge_support/FocusedZipImporter.scala [21:38]
private def toZipEntryPath(n: String): String = focus match {
case None => n
case Some(f) =>
@annotation.tailrec
def loop(leftPart: File, p: List[String]): File = p match {
case Nil => leftPart
case ".." :: tail =>
val parent = leftPart.getParentFile
if (parent == null) sys.error(s"invalid path: $n with focus: $focus for zips: $zips")
else loop(parent, tail)
case "." :: tail => loop(leftPart, tail)
case child :: tail => loop(new File(leftPart, child), tail)
}
val parts = n.split("/", -1).toList
val newPath = loop(f, parts).getPath.replaceAllLiterally(File.separator, "/")
if (parts(0) == File.pathSeparatorChar) newPath.substring(1)
else newPath
}