Skip to content

Commit bd4bb6b

Browse files
authored
Added Mac Silicon support. (#28)
1 parent bb47b56 commit bd4bb6b

File tree

4 files changed

+385
-10
lines changed

4 files changed

+385
-10
lines changed

bin/index.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/usr/bin/env node
22

3-
import os from 'os';
4-
53
import chalk from 'chalk';
64

75
import meow from 'meow';
@@ -14,6 +12,7 @@ import {
1412
EDITOR_INSTALLERS_FILE_PATH,
1513
updateEditorInstallers,
1614
} from '../lib/update-editor-installers.js';
15+
import { getOperatingSystemKey } from '../lib/os.js';
1716
import { getUnityUrls } from '../lib/get-unity-urls.js';
1817
import { parseVersionFromString } from '../lib/parsers.js';
1918

@@ -64,12 +63,6 @@ const cli = meow(
6463
}
6564
);
6665

67-
const osKeyMap = {
68-
Darwin: 'mac',
69-
Linux: 'linux',
70-
Windows_NT: 'win64',
71-
};
72-
7366
const DEFAULT_CACHE_TTL = 3600000;
7467

7568
updateNotifier({ pkg: (await readPackageUp()).packageJson }).notify();
@@ -84,10 +77,12 @@ if (cli.flags.file) {
8477
}
8578
}
8679

80+
const osKey = getOperatingSystemKey();
81+
8782
if (cli.flags.offline) {
8883
const urls = await getUnityUrls(cli.input[0], EDITOR_INSTALLERS_FILE_PATH);
8984

90-
process.stdout.write(`${urls[osKeyMap[os.type()]]}`);
85+
process.stdout.write(`${urls[osKey]}`);
9186
} else {
9287
try {
9388
await updateEditorInstallers(
@@ -97,7 +92,7 @@ if (cli.flags.offline) {
9792

9893
const urls = await getUnityUrls(cli.input[0], EDITOR_INSTALLERS_FILE_PATH);
9994

100-
process.stdout.write(`${urls[osKeyMap[os.type()]]}`);
95+
process.stdout.write(`${urls[osKey]}`);
10196
} catch (error) {
10297
process.stderr.write(`${chalk.red('Error:')} ${error.message}`);
10398
}

0 commit comments

Comments
 (0)