1
0
mirror of https://github.com/jiahaog/Nativefier synced 2024-06-26 07:38:59 +02:00
Nativefier/src/infer/inferOs.js
2018-05-24 00:02:44 -07:00

29 lines
543 B
JavaScript

import os from 'os';
function inferPlatform() {
const platform = os.platform();
if (
platform === 'darwin' ||
platform === 'mas' ||
platform === 'win32' ||
platform === 'linux'
) {
return platform;
}
throw new Error(`Untested platform ${platform} detected`);
}
function inferArch() {
const arch = os.arch();
if (arch !== 'ia32' && arch !== 'x64' && arch !== 'arm') {
throw new Error(`Incompatible architecture ${arch} detected`);
}
return arch;
}
export default {
inferPlatform,
inferArch,
};