Skip to content

Commit cf855f3

Browse files
Merge pull request #1 from homy-game-studio/add-mac-support
feat: Add mac support
2 parents 94ac2ee + c9c772b commit cf855f3

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/modules/unity.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,17 @@ import process from 'process';
44

55
export type UnityInstallations = Record<string, string>;
66

7-
const programFiles = process.env.ProgramFiles || path.resolve("C:/Program Files/");
8-
const unityHubPath = process.env.UnityHub || path.join(programFiles, "Unity Hub", "Unity Hub.exe")
7+
const getUnityHubPath = () => {
8+
switch (process.platform) {
9+
case "win32": {
10+
const programFiles = process.env.ProgramFiles || "C:/Program Files";
11+
return path.resolve(programFiles, "Unity Hub/Unity Hub.exe");
12+
}
13+
default: return "/Applications/Unity Hub.app/Contents/MacOS/Unity Hub"
14+
}
15+
}
16+
17+
const unityHubPath = getUnityHubPath();
918

1019
export const getUnityInstallations = async (): Promise<UnityInstallations> => {
1120
const { stdout } = await execa(unityHubPath, "-- --headless editors -i".split(" "), { reject: false });

0 commit comments

Comments
 (0)