This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zx | |
const path = process.argv[3] | |
const matches = path.match(/^([A-Z]):(.+\n?)/) | |
if(matches) { | |
const [_, driveLetter, path] = matches | |
const unixPath = path.replace(/\\/g, "/").replace(/([ \(\)])/g, '\\$1'); | |
const lowerDriveLetter = driveLetter.toLowerCase(); | |
console.log(`/mnt/${lowerDriveLetter}${unixPath}`); | |
} else { | |
console.log(path) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to use
zx https://gist.githubusercontent.com/himanoa/92f4bbb0cbb247adecb5dc3e4fc0171c/raw/6e78859da481ac8c7a17957f9f9e5b493bc7702c/change-path-from-win-to-wsl2 "WindowsFilePath"