Skip to content
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

WSL: Ignore commented mount point lines in wsl.conf #247

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -42,7 +42,7 @@ const getWslDrivesMountPoint = (() => {
}

const configContent = await fs.readFile(configFilePath, {encoding: 'utf8'});
const configMountPoint = /root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex results in an error: https://regex101.com/r/4pJXHS/1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I see the error, has the regex101 test string changed? I just see #root and root below it which doesn't match, but that's no different to the original regex because it expects = after root. If I change the second line to root=/ it finds the match group.

I've tested this change locally with a #root comment directly above the actual mount point setting and it worked as expected.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. It turns out I was looking at it with Safari and Safari doesn't support negative lookbehind.


if (!configMountPoint) {
return defaultMountPoint;
Expand Down