Skip to content

Commit

Permalink
improve macOS path resolution for app bundles (#632)
Browse files Browse the repository at this point in the history
  • Loading branch information
s7m4b4 authored Apr 29, 2024
1 parent 6b009ea commit df445b8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/utils/project_utils.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit df445b8

Please sign in to comment.