-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SourceFileTest.testSourceFileResolvesZipEntries failes for Windows #3206 #3207
Conversation
@@ -359,13 +359,13 @@ public String toString() { | |||
private static final String JAR_URL_PREFIX = "jar:file:"; | |||
|
|||
private static boolean isZipEntry(String path) { | |||
return path.contains(".zip!" + File.separatorChar) && (path.endsWith(".js") || path.endsWith(".js.map")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be clear, what's the issue with File.separatorChar
in GWT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It simple does not exists in the emulation / super source.
} | ||
|
||
@GwtIncompatible("java.io.File") | ||
private static SourceFile fromZipEntry(String zipURL, Charset inputCharset) { | ||
checkArgument(isZipEntry(zipURL)); | ||
String[] components = zipURL.split(Pattern.quote(BANG_SLASH.replace('/', File.separatorChar))); | ||
String[] components = zipURL.split(Pattern.quote(BANG_SLASH.replace("/", File.separator))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of doing a replace, can you fix the BANG_SLASH
definition to
private static final String BANG_SLASH = "!" + File.separatorChar;
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was also my first idea, but BANG_SLASH is used 3 times, but only one is windows (path) dependend. Only using another constant (like BANG_SLASH_FS_SPECIAL) would be a way to go, but I think this more confusing.
@@ -378,7 +379,7 @@ private static SourceFile fromZipEntry(String zipURL, Charset inputCharset) { | |||
public static SourceFile fromZipEntry( | |||
String originalZipPath, String absoluteZipPath, String entryPath, Charset inputCharset) | |||
throws MalformedURLException { | |||
String zipEntryPath = JAR_URL_PREFIX + absoluteZipPath + BANG_SLASH + entryPath; | |||
String zipEntryPath = JAR_URL_PREFIX + absoluteZipPath + BANG_SLASH + entryPath.replace(File.pathSeparatorChar, '/'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be File.separatorChar
instead of File.pathSeparatorChar
?
My understanding is that separatorChar
is the path component separator (/
on Unix, \
on Windows), while pathSeparatorChar
is the PATH
environment variable separator (:
on Unix, ;
on Windows).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was fixed with the second commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once you address the review comments, can you please squash the two commits into a single one?
Created Google internal issue b/123291586 |
…ogle#3206 And fixes parts of "Support the workflow under Windows. google#9" (google/j2cl#9) from j2cl
Squash is done! |
See also google/j2cl#9. Fixes google#3206. Closes google#3207. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=230635801
And fixes parts of "Support the workflow under Windows. #9" (google/j2cl#9) from j2cl