Skip to content

Commit f67c2fb

Browse files
fix: Mac unity command
1 parent cf855f3 commit f67c2fb

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/modules/unity.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ const getUnityHubPath = () => {
1414
}
1515
}
1616

17+
const parseUnityPath = (basePath: string) => {
18+
switch (process.platform) {
19+
case "win32": return basePath;
20+
default: return path.join(basePath, "/Contents/MacOS/Unity");
21+
}
22+
}
23+
1724
const unityHubPath = getUnityHubPath();
1825

1926
export const getUnityInstallations = async (): Promise<UnityInstallations> => {
@@ -26,11 +33,11 @@ export const getUnityInstallations = async (): Promise<UnityInstallations> => {
2633
const installations: UnityInstallations = {};
2734

2835
lines.forEach(line => {
29-
const [version, path] = line
36+
const [version, unityPath] = line
3037
.split(", installed at")
3138
.map(entry => entry.trim());
3239

33-
if (!!version || !!path) installations[version] = path;
40+
if (!!version || !!path) installations[version] = parseUnityPath(unityPath);
3441
});
3542

3643
if (Object.keys(installations).length == 0) throw `No unity installations found at ${unityHubPath}.`;

0 commit comments

Comments
 (0)