-
Notifications
You must be signed in to change notification settings - Fork 316
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
Store the package and name of a Label as strings rather than paths, to avoid occurrence of backslashes on Windows #7271
base: master
Are you sure you want to change the base?
Conversation
} | ||
} | ||
|
||
private static String withForwardSlashes(Path p) { |
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.
com.intellij.openapi.util.io.FileUtilRt#toSystemIndependentName
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 turns out not so easy to refactor. This package is pretty low in the dependency hierarchy, and it doesn't depend on the IntelliJ API.
@@ -57,17 +56,22 @@ public static Label of(String label) { | |||
} | |||
|
|||
public static Label fromWorkspacePackageAndName(String workspace, Path packagePath, Path name) { |
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.
add test too, to see that it works with WindowsPath
?
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.
You mean the subclass of java.nio.file.Path
? Unfortunately, it only exists on Windows JVMs. However, I have verified manually that my changes fix the issue on Windows.
@@ -202,8 +202,8 @@ public int index(String s) { | |||
public Query.StoredLabel indexLabel(Label l) { | |||
return Query.StoredLabel.newBuilder() | |||
.setWorkspace(index(l.getWorkspaceName())) | |||
.setBuildPackage(index(l.getPackage().toString())) | |||
.setName(index(l.getName().toString())) | |||
.setBuildPackage(index(l.buildPackage())) |
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.
I searched for getPackage()
and subsequent call to toString
that introduces backslashes and found
public Builder add(Label target) { |
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.
I'm not sure this has any adverse effects (FWIW TargetTreeTest
passes on Windows), but I will fix this just in case.
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 tried to import our repository on windows with your changes and got this exception. Without your changes it was possible to import our repository (after removing excluded directories from the project view file).
4c01421
to
9bc1431
Compare
…o avoid occurrence of backslashes on Windows
Checklist
Please note that the maintainers will not be reviewing this change until all checkboxes are ticked. See
the Contributions section in the README for more
details.
Discussion thread for this change
Issue number: #7258
Description of this change