- Notifications
You must be signed in to change notification settings - Fork670
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
support WSL#46
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
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(); | ||
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. If we use 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. Not Work :( functiontoWslPath(path){returncp.execFileSync("wsl",["wslpath","-u",`"${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. With For this program, we just need do good job with file system and shell command for cross-platform. I think the We can try to change these next time if needed. 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. We could focus on 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 That is because by default the option Another thing I'm concerning is that here we use 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.
We need a lot of works if we use async/await. Abstract But we could improve step by step. Half a loaf is better than no bread. 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. OK, make sense. Tracking issue:#48 | ||
} | ||
export function toWinPath(path: string): string { | ||
return cp.execFileSync("wsl", ["wslpath", "-w", path]).toString().trim(); | ||
} |