wsl-path
Version:
Convert Windows paths to WSL (1 & 2) paths and vice versa
24 lines (23 loc) • 883 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.determineMountPoints = void 0;
var child_process_1 = require("child_process");
/**
* Module for determining the (linux) mount point of a file
*/
var determineMountPoints = function (wslCommand) {
var stdout = (0, child_process_1.execSync)("".concat(wslCommand, " -e mount")).toString();
return stdout
.trim()
.split("\n")
.map(function (line) { return line.split(" "); })
.map(function (_a) {
var windowsPath = _a[0], _ = _a[1], linuxPath = _a[2], __ = _a[3], type = _a[4];
return ({
src: linuxPath,
target: type === "9p" || type === "drvfs" ? windowsPath : undefined,
});
})
.sort(function (a, b) { return b.src.length - a.src.length; });
};
exports.determineMountPoints = determineMountPoints;