From df445b8390b5575c6e2b63ca7d6bdc1763154604 Mon Sep 17 00:00:00 2001 From: Stephen Bell <8148044+s7m4b4@users.noreply.github.com> Date: Tue, 30 Apr 2024 09:55:52 +1000 Subject: [PATCH] improve macOS path resolution for app bundles (#632) --- src/utils/project_utils.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/utils/project_utils.ts b/src/utils/project_utils.ts index 368555373..cdcd27380 100644 --- a/src/utils/project_utils.ts +++ b/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);