Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sindresorhus/open
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v7.4.1
Choose a base ref
...
head repository: sindresorhus/open
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v7.4.2
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Feb 16, 2021

  1. Verified

    This commit was signed with the committer’s verified signature.
    dtolnay David Tolnay
    Copy the full SHA
    f4df68a View commit details
  2. 7.4.2

    sindresorhus committed Feb 16, 2021

    Verified

    This commit was signed with the committer’s verified signature.
    dtolnay David Tolnay
    Copy the full SHA
    a9babe0 View commit details
Showing with 12 additions and 5 deletions.
  1. +11 −4 index.js
  2. +1 −1 package.json
15 changes: 11 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -19,6 +19,10 @@ Get the mount point for fixed drives in WSL.
@returns {string} The mount point.
*/
const getWslDrivesMountPoint = (() => {
// Default value for "root" param
// according to https://docs.microsoft.com/en-us/windows/wsl/wsl-config
const defaultMountPoint = '/mnt/';

let mountPoint;

return async function () {
@@ -36,14 +40,17 @@ const getWslDrivesMountPoint = (() => {
} catch (_) {}

if (!isConfigFileExists) {
// Default value for "root" param
// according to https://docs.microsoft.com/en-us/windows/wsl/wsl-config
return '/mnt/';
return defaultMountPoint;
}

const configContent = await pReadFile(configFilePath, {encoding: 'utf8'});
const configMountPoint = /root\s*=\s*(.*)/g.exec(configContent);

if (!configMountPoint) {
return defaultMountPoint;
}

mountPoint = (/root\s*=\s*(.*)/g.exec(configContent)[1] || '').trim();
mountPoint = configMountPoint[1].trim();
mountPoint = mountPoint.endsWith('/') ? mountPoint : mountPoint + '/';

return mountPoint;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "open",
"version": "7.4.1",
"version": "7.4.2",
"description": "Open stuff like URLs, files, executables. Cross-platform.",
"license": "MIT",
"repository": "sindresorhus/open",