File tree 1 file changed +11
-4
lines changed
1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,10 @@ Get the mount point for fixed drives in WSL.
19
19
@returns {string } The mount point.
20
20
*/
21
21
const getWslDrivesMountPoint = ( ( ) => {
22
+ // Default value for "root" param
23
+ // according to https://docs.microsoft.com/en-us/windows/wsl/wsl-config
24
+ const defaultMountPoint = '/mnt/' ;
25
+
22
26
let mountPoint ;
23
27
24
28
return async function ( ) {
@@ -36,14 +40,17 @@ const getWslDrivesMountPoint = (() => {
36
40
} catch ( _ ) { }
37
41
38
42
if ( ! isConfigFileExists ) {
39
- // Default value for "root" param
40
- // according to https://docs.microsoft.com/en-us/windows/wsl/wsl-config
41
- return '/mnt/' ;
43
+ return defaultMountPoint ;
42
44
}
43
45
44
46
const configContent = await pReadFile ( configFilePath , { encoding : 'utf8' } ) ;
47
+ const configMountPoint = / r o o t \s * = \s * ( .* ) / g. exec ( configContent ) ;
48
+
49
+ if ( ! configMountPoint ) {
50
+ return defaultMountPoint ;
51
+ }
45
52
46
- mountPoint = ( / r o o t \s * = \s * ( . * ) / g . exec ( configContent ) [ 1 ] || '' ) . trim ( ) ;
53
+ mountPoint = configMountPoint [ 1 ] . trim ( ) ;
47
54
mountPoint = mountPoint . endsWith ( '/' ) ? mountPoint : mountPoint + '/' ;
48
55
49
56
return mountPoint ;
You can’t perform that action at this time.
0 commit comments