فهرست منبع

improve macOS path resolution for app bundles (#632)

Stephen Bell 1 سال پیش
والد
کامیت
df445b8390
1فایلهای تغییر یافته به همراه5 افزوده شده و 0 حذف شده
  1. 5 0
      src/utils/project_utils.ts

+ 5 - 0
src/utils/project_utils.ts

@@ -1,6 +1,7 @@
 import * as vscode from "vscode";
 import * as path from "path";
 import * as fs from "fs";
+import * as os from "os";
 import { execSync } from "child_process";
 import { get_configuration } from "./vscode_utils";
 
@@ -109,6 +110,10 @@ type VERIFY_RESULT = {
 
 export function verify_godot_version(godotPath: string, expectedVersion: "3" | "4" | string): VERIFY_RESULT {
 	try {
+		if (os.platform() === 'darwin' && godotPath.endsWith('.app')) {
+			godotPath = path.join(godotPath, 'Contents', 'MacOS', 'Godot');
+		}
+
 		const output = execSync(`"${godotPath}" --version`).toString().trim();
 		const pattern = /^(([34])\.([0-9]+)(?:\.[0-9]+)?)/m;
 		const match = output.match(pattern);