46
46
import java .util .Arrays ;
47
47
import java .util .Enumeration ;
48
48
import java .util .List ;
49
+ import java .util .regex .Pattern ;
49
50
import java .util .zip .ZipEntry ;
50
51
import java .util .zip .ZipFile ;
51
52
@@ -358,13 +359,13 @@ public static List<SourceFile> fromZipFile(String zipName, Charset inputCharset)
358
359
private static final String JAR_URL_PREFIX = "jar:file:" ;
359
360
360
361
private static boolean isZipEntry (String path ) {
361
- return path .contains (".zip!/" ) && (path .endsWith (".js" ) || path .endsWith (".js.map" ));
362
+ return path .contains (".zip!" + File . separator ) && (path .endsWith (".js" ) || path .endsWith (".js.map" ));
362
363
}
363
364
364
365
@ GwtIncompatible ("java.io.File" )
365
366
private static SourceFile fromZipEntry (String zipURL , Charset inputCharset ) {
366
367
checkArgument (isZipEntry (zipURL ));
367
- String [] components = zipURL .split (BANG_SLASH );
368
+ String [] components = zipURL .split (Pattern . quote ( BANG_SLASH . replace ( "/" , File . separator )) );
368
369
try {
369
370
String zipPath = components [0 ];
370
371
String relativePath = components [1 ];
@@ -378,7 +379,7 @@ private static SourceFile fromZipEntry(String zipURL, Charset inputCharset) {
378
379
public static SourceFile fromZipEntry (
379
380
String originalZipPath , String absoluteZipPath , String entryPath , Charset inputCharset )
380
381
throws MalformedURLException {
381
- String zipEntryPath = JAR_URL_PREFIX + absoluteZipPath + BANG_SLASH + entryPath ;
382
+ String zipEntryPath = JAR_URL_PREFIX + absoluteZipPath + BANG_SLASH + entryPath . replace ( File . pathSeparator , "/" ) ;
382
383
URL zipEntryUrl = new URL (zipEntryPath );
383
384
384
385
return builder ()
0 commit comments