diff options
author | LinuxWizard42 <computerwizard@linuxmail.org> | 2022-10-12 22:54:37 +0300 |
---|---|---|
committer | LinuxWizard42 <computerwizard@linuxmail.org> | 2022-10-12 22:54:37 +0300 |
commit | 703e03aba33f234712206769f57717ba7d92d23d (patch) | |
tree | 0041f04ccb75bd5379c764e9fe42249fffe75fc3 /node_modules/cross-spawn-windows-exe/dist/src/normalize-path.js | |
parent | ab6e257e6e9d9a483d7e86f220d8b209a2cd7753 (diff) | |
download | FlashRunner-703e03aba33f234712206769f57717ba7d92d23d.tar.gz FlashRunner-703e03aba33f234712206769f57717ba7d92d23d.tar.zst |
Added export_allowed file to make repository visible in cgit
Diffstat (limited to 'node_modules/cross-spawn-windows-exe/dist/src/normalize-path.js')
-rw-r--r-- | node_modules/cross-spawn-windows-exe/dist/src/normalize-path.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/node_modules/cross-spawn-windows-exe/dist/src/normalize-path.js b/node_modules/cross-spawn-windows-exe/dist/src/normalize-path.js new file mode 100644 index 0000000..0b07b45 --- /dev/null +++ b/node_modules/cross-spawn-windows-exe/dist/src/normalize-path.js @@ -0,0 +1,38 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.normalizePath = exports.convertUNIXPathToWindows = void 0; +const is_wsl_1 = __importDefault(require("is-wsl")); +const cross_spawn_promise_1 = require("@malept/cross-spawn-promise"); +/** + * Provides a human-friendly error message when `@malept/cross-spawn-promise` can't find `wslpath`. + */ +function updateWSLPathError(error) { + if (error.code === "ENOENT" && error.syscall === "spawn wslpath") { + error.message = `Could not find 'wslpath' in any of the directories listed in the PATH environment variable, which is needed to convert WSL paths to Windows-style paths.`; + } +} +/** + * Converts a UNIX-style path to a Windows-style path via `wslpath`, which should come with any + * WSL distribution. + */ +async function convertUNIXPathToWindows(wslPath) { + const output = await cross_spawn_promise_1.spawn("wslpath", ["-w", wslPath], { + updateErrorCallback: updateWSLPathError, + }); + return output.trim(); +} +exports.convertUNIXPathToWindows = convertUNIXPathToWindows; +/** + * Converts a UNIX-style path to a Windows-style path if run in a WSL environment. + */ +async function normalizePath(pathToNormalize) { + if (is_wsl_1.default) { + return convertUNIXPathToWindows(pathToNormalize); + } + return pathToNormalize; +} +exports.normalizePath = normalizePath; +//# sourceMappingURL=normalize-path.js.map
\ No newline at end of file |