Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1798edd

Browse files
authored
fix: Failed to resolve the Node executable path when it contains spaces (LeetCode-OpenSource#363)
1 parent453c51a commit1798edd

File tree

5 files changed

+9
-4
lines changed

5 files changed

+9
-4
lines changed

‎README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
|**(Deprecated)**`leetcode.enableShortcuts`| Specify whether the submit and test shortcuts in editor or not.|`true`|
128128
|`leetcode.editor.shortcuts`| Specify the customized shorcuts in editors. Supported values are:`submit`,`test`,`solution` and`description`.|`["submit, test"]`|
129129
|`leetcode.enableSideMode`| Specify whether`preview`,`solution` and`submission` tab should be grouped into the second editor column when solving a problem.|`true`|
130-
|`leetcode.nodePath`| Specify the`Node.js` executable path.|`node`|
130+
|`leetcode.nodePath`| Specify the`Node.js` executable path.for example, C:\Program Files\nodejs\node.exe|`node`|
131131

132132
##Want Help?
133133

‎docs/README_zh-CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
|**(Deprecated)**`leetcode.enableShortcuts`| 指定是否在 VS Code 编辑文件下方显示提交和测试的快捷按钮。|`true`|
128128
|`leetcode.editor.shortcuts`| 指定在编辑器内所自定义的快捷方式。可用的快捷方式有:`submit`,`test`,`solution`,`description`|`["submit, test"]`|
129129
|`leetcode.enableSideMode`| 指定在解决一道题时,是否将`问题预览``高票答案``提交结果`窗口集中在编辑器的第二栏。|`true`|
130-
|`leetcode.nodePath`| 指定`Node.js` 可执行文件的路径。|`node`|
130+
|`leetcode.nodePath`| 指定`Node.js` 可执行文件的路径。如:C:\Program Files\nodejs\node.exe|`node`|
131131

132132
##需要帮助?
133133
在遇到任何问题时,可以先查看一下[疑难解答](https://github.com/jdneo/vscode-leetcode/wiki/%E7%96%91%E9%9A%BE%E8%A7%A3%E7%AD%94)以及[常见问题](https://github.com/jdneo/vscode-leetcode/wiki/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98)寻求帮助。

‎package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@
361361
"type":"string",
362362
"default":"node",
363363
"scope":"application",
364-
"description":"The Node.js executable path."
364+
"description":"The Node.js executable path. for example, C:\\Program Files\\nodejs\\node.exe"
365365
}
366366
}
367367
}

‎src/leetCodeExecutor.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ class LeetCodeExecutor implements Disposable {
4949
if(!awaitfse.pathExists(this.nodeExecutable)){
5050
thrownewError(`The Node.js executable does not exist on path${this.nodeExecutable}`);
5151
}
52+
// Wrap the executable with "" to avoid space issue in the path.
53+
this.nodeExecutable=`"${this.nodeExecutable}"`;
5254
if(useWsl()){
5355
this.nodeExecutable=awaittoWslPath(this.nodeExecutable);
5456
}

‎src/utils/workspaceUtils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ export async function getActiveFilePath(uri?: vscode.Uri): Promise<string | unde
6464

6565
functionisSubFolder(from:string,to:string):boolean{
6666
constrelative:string=path.relative(from,to);
67-
return!!relative&&!relative.startsWith("..")&&!path.isAbsolute(relative);
67+
if(relative===""){
68+
returntrue;
69+
}
70+
return!relative.startsWith("..")&&!path.isAbsolute(relative);
6871
}
6972

7073
enumOpenOption{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp