-
Notifications
You must be signed in to change notification settings - Fork 6
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
Fixed module path separator in Windows #116
Fixed module path separator in Windows #116
Conversation
Module path separator in Windows is currently "/" ie: dw/util/Math, which is incorrect. It should be "::" (ie: dw::util::Math). This is because Intellij's virtual file uses "/" separator, but Dataweave parser SDK expects the native file separator, which is "\" in Windows. Pre-correcting the file separator before sending the path to the parser SDK fixes this issue. This bug caused modules and some functions as being not resolvable in the editor. Also, the auto suggest gives the wrong path (ie: suggesting dw/util/Math instead of dw::util::Math).
@@ -126,7 +127,7 @@ private static VirtualFile resolve(Project project, NameIdentifier name, GlobalS | |||
public static NameIdentifier getNameIdentifierWithRelative(VirtualFile vfs, VirtualFile contentRootForFile) { | |||
final String relPath = VfsUtil.getRelativePath(vfs, contentRootForFile); | |||
if (relPath != null) { | |||
return NameIdentifierHelper.fromWeaveFilePath(relPath); | |||
return NameIdentifierHelper.fromWeaveFilePath(FileSystems.getDefault().getSeparator().equals("\\") ? relPath.replace("/", "\\") : relPath); |
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.
return NameIdentifierHelper.fromWeaveFilePath(FileSystems.getDefault().getSeparator().equals("\\") ? relPath.replace("/", "\\") : relPath); | |
return NameIdentifierHelper.fromWeaveFilePath(relPath, FileSystems.getDefault().getSeparator()); |
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 is much simpler and should have the same outcome
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.
Indeed, a new fix pushed. Thanks
Thanks for the contribution! Unfortunately we can't verify the commit author(s): Abi Harbani <a***@g***.com>. One possible solution is to add that email to your GitHub account. Alternatively you can change your commits to another email and force push the change. After getting your commits associated with your GitHub account, sign the Salesforce Inc. Contributor License Agreement and this Pull Request will be revalidated. |
4c199f2
to
9c1bf1a
Compare
Module path separator in Windows is currently "/" ie: dw/util/Math, which is incorrect. It should be "::" (ie: dw::util::Math). This is because Intellij's virtual file uses "/" separator, but Dataweave parser SDK expects the native file separator, which is "" in Windows.
Pre-correcting the file separator before sending the path to the parser SDK fixes this issue.
This bug caused modules and some functions as being not resolvable in the editor. Also, the auto suggest gives the wrong path (ie: suggesting dw/util/Math instead of dw::util::Math).