11package io .bazel .rules_scala .scrooge_support
22
3- import com .twitter .scrooge .frontend .{ FileContents , Importer }
3+ import com .twitter .scrooge .frontend .{FileContents , Importer }
44
55import java .io .File
6- import java .util .zip .{ZipFile , ZipEntry }
6+ import java .util .zip .{ZipEntry , ZipFile }
77import scala .io .Source
88
99object FocusedZipImporter {
@@ -31,10 +31,13 @@ case class FocusedZipImporter(focus: Option[File], zips: List[File], zipFiles: L
3131 case " ." :: tail => loop(leftPart, tail)
3232 case child :: tail => loop(new File (leftPart, child), tail)
3333 }
34+
3435 val parts = n.split(" /" , - 1 ).toList
35- val newPath = loop(f, parts).getPath.replaceAllLiterally(File .separator, " /" )
36- if (parts(0 ) == File .pathSeparatorChar) newPath.substring(1 )
37- else newPath
36+ val newPath = loop(f, parts).getPath.replace(File .separator, " /" )
37+ if (parts.head == File .separator)
38+ newPath.substring(1 )
39+ else
40+ newPath
3841 }
3942
4043 private def resolve (filename : String ): Option [(ZipEntry , ZipFile , FocusedZipImporter )] = {
@@ -51,6 +54,7 @@ case class FocusedZipImporter(focus: Option[File], zips: List[File], zipFiles: L
5154 }
5255
5356 private val maxLastMod = zips.map(_.lastModified).reduceOption(_ max _)
57+
5458 // uses the lastModified time of the zip/jar file
5559 def lastModified (filename : String ): Option [Long ] =
5660 resolve(filename).flatMap(_ => maxLastMod)
0 commit comments