forked from electron/update.electronjs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathasset-platform.js
31 lines (25 loc) · 862 Bytes
/
asset-platform.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const { PLATFORM_ARCH } = require("./constants");
const assetPlatform = (fileName) => {
if (/.*-(mac|darwin|osx).*\.zip$/i.test(fileName)) {
if (/-arm64/.test(fileName)) return PLATFORM_ARCH.DARWIN_ARM64;
if (/-universal/.test(fileName)) return PLATFORM_ARCH.DARWIN_UNIVERSAL;
return PLATFORM_ARCH.DARWIN_X64;
}
if (/win32-ia32/.test(fileName)) return PLATFORM_ARCH.WIN_IA32;
if (/win32-x64/.test(fileName)) return PLATFORM_ARCH.WIN_X64;
if (/win32-arm64/.test(fileName)) return PLATFORM_ARCH.WIN_ARM64;
// Special case handling: We don't know what kind of asset
// we're looking at, so it might be the default x64 windows
// asset
if (
/\.exe$/.test(fileName) &&
!/arm/.test(fileName) &&
!/ia32/.test(fileName)
) {
return PLATFORM_ARCH.WIN_X64;
}
return false;
};
module.exports = {
assetPlatform,
};