瀏覽代碼

Fix version check of Godot binary (#592)

* Change default value for godotTools.editorPath.godot4 to "godot"

* Switch godot version check back to using --version
David Kincaid 1 年之前
父節點
當前提交
436ff64d07
共有 2 個文件被更改,包括 3 次插入3 次删除
  1. 1 1
      package.json
  2. 2 2
      src/utils/project_utils.ts

+ 1 - 1
package.json

@@ -230,7 +230,7 @@
 				},
 				"godotTools.editorPath.godot4": {
 					"type": "string",
-					"default": "godot4",
+					"default": "godot",
 					"description": "Path to the Godot 4 editor executable"
 				},
 				"godotTools.editor.verbose": {

+ 2 - 2
src/utils/project_utils.ts

@@ -95,8 +95,8 @@ type VERIFY_RESULT = {
 
 export function verify_godot_version(godotPath: string, expectedVersion: "3" | "4" | string): VERIFY_RESULT {
 	try {
-		const output = execSync(`"${godotPath}" -h`).toString().trim();
-		const pattern = /^Godot Engine v(([34])\.([0-9]+)(?:\.[0-9]+)?)/m;
+		const output = execSync(`"${godotPath}" --version`).toString().trim();
+		const pattern = /^(([34])\.([0-9]+)(?:\.[0-9]+)?)/m;
 		const match = output.match(pattern);
 		if (!match) {
 			return { status: "INVALID_EXE" };