-
Notifications
You must be signed in to change notification settings - Fork 665
support WSL #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support WSL #46
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
"use strict"; | ||
|
||
import * as cp from "child_process"; | ||
import * as vscode from "vscode"; | ||
|
||
export function useWsl(): boolean { | ||
const leetCodeConfig: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration("leetcode"); | ||
|
||
return process.platform === "win32" && leetCodeConfig.get<boolean>("useWsl") === true; | ||
} | ||
|
||
export function toWslPath(path: string): string { | ||
return cp.execFileSync("wsl", ["--", "wslpath", "-u", `${path.replace(/\\/g, "/")}`]).toString().trim(); | ||
} | ||
|
||
export function toWinPath(path: string): string { | ||
return cp.execFileSync("wsl", ["--", "wslpath", "-w", path]).toString().trim(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks the 1st param "--" doesn't work for me. CMD>wsl wslpath -w /mnt/c/
C:\ CMD>wsl -- wslpath -w /mnt/c/
/bin/bash: --: invalid option
Usage: /bin/bash [GNU long option] [option] ...
/bin/bash [GNU long option] [option] script-file ...
GNU long options:
--debug
--debugger
--dump-po-strings
--dump-strings
--help
--init-file
--login
--noediting
--noprofile
--norc
--posix
--rcfile
--restricted
--verbose
--version
Shell options:
-ilrsD or -c command or -O shopt_option (invocation only)
-abefhkmnptuvxBCHP or -o option There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please check the Windows version, maybe this param can be removed.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Attaching mine.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @purocean If you remove the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://docs.microsoft.com/en-us/windows/wsl/release-notes#wsl-5 @jdneo yes, perfect. So we can remove it. |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nodejs -> Node.js