os#arch TypeScript Examples
The following examples show how to use
os#arch.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: spFormat.ts From sourcepawn-vscode with MIT License | 6 votes |
getNativeBinary() {
let nativeBinary;
const sysPlatform = platform();
const sysArch = arch();
const ext = extensions.getExtension("Sarrus.sourcepawn-vscode");
if (ext === undefined) {
throw Error("Extension not found.");
}
const myExtDir = ext.extensionPath;
if (sysPlatform === "win32") {
nativeBinary = join(myExtDir, "/bin/win32/clang-format.exe");
} else {
nativeBinary = join(
myExtDir,
`/bin/${sysPlatform}_${sysArch}/clang-format`
);
}
if (existsSync(nativeBinary)) {
return nativeBinary;
}
// Let arm64 macOS fall back to x64
if (sysPlatform === "darwin" && sysArch === "arm64") {
nativeBinary = join(myExtDir, `/bin/darwin_x64/clang-format`);
if (existsSync(nativeBinary)) {
return nativeBinary;
}
}
const message =
"This module doesn't bundle the clang-format executable for your platform. " +
`(${sysPlatform}_${sysArch})\n` +
"Please let the author know on GitHub.\n";
throw new Error(message);
}
Example #2
Source File: index.ts From action with MIT License | 6 votes |
function getPlatformArch (a: string, p: string): string {
const platform = {
win32: 'windows'
}
const arch = {
x64: 'amd64',
x32: '386'
}
return (platform[p] ? platform[p] : p) + '/' + (arch[a] ? arch[a] : a)
}
Example #3
Source File: VoiceProviderManager.ts From discord-qt with GNU General Public License v3.0 | 6 votes |
constructor() {
const architecture = arch();
switch (platform()) {
case 'linux':
this.provider = new LinuxVoiceProvider();
break;
case 'win32':
if (['ia32', 'x64'].includes(architecture)) {
this.provider = new Win32VoiceProvider();
} else {
warnNoSupport();
}
break;
case 'darwin':
if (architecture === 'x64') {
this.provider = new DarwinVoiceProvider();
} else {
warnNoSupport();
}
break;
default:
}
}
Example #4
Source File: update.ts From dbm with Apache License 2.0 | 5 votes |
function handlerUpdater(mainWindow: BrowserWindow) {
console.log(platform(), arch());
console.log(process.env.NODE_ENV);
let uploadUrl = 'https://downloads.edurt.io/dbm/releases/' + platform() + '/' + arch() + '/';
if (process.env.NODE_ENV === 'development') {
uploadUrl = 'http://localhost:7777/release/';
}
console.log(uploadUrl);
autoUpdater.setFeedURL(uploadUrl)
autoUpdater.autoDownload = false
let cancellationToken = new CancellationToken();;
autoUpdater.on('error', (err) => {
if (err.message.includes('sha512 checksum mismatch')) {
handlerMessage(mainWindow, UpdateEnum.error, 'sha512 checksum mismatch')
}
})
ipcMain.on('checking-for-update', (event, arg) => {
console.log('checking-for-update')
handlerMessage(mainWindow, UpdateEnum.checking)
})
autoUpdater.on('update-available', (info) => {
console.log('update-available')
handlerMessage(mainWindow, UpdateEnum.hasversion, info)
})
autoUpdater.on('update-not-available', (event, arg) => {
console.log('update-not-available')
handlerMessage(mainWindow, UpdateEnum.noversion, arg)
})
autoUpdater.on('download-progress', (progressObj) => {
console.log('download-progress')
handlerMessage(mainWindow, UpdateEnum.downloading, progressObj)
})
autoUpdater.on('update-downloaded', () => {
console.log('update-downloaded')
handlerMessage(mainWindow, UpdateEnum.completed)
})
ipcMain.on('check-update', () => {
console.log('update-not-available')
autoUpdater.checkForUpdates().catch(err => {
handlerMessage(mainWindow, UpdateEnum.failed, err)
})
})
ipcMain.on('confirm-update', () => {
console.log('quit install')
try {
autoUpdater.quitAndInstall(true, true);
} catch (e) {
console.log('Error', 'Failed to install updates', e);
handlerMessage(mainWindow, UpdateEnum.failed, e);
}
})
ipcMain.on('confirm-downloadUpdate', () => {
autoUpdater.downloadUpdate(cancellationToken).catch(err => {
handlerMessage(mainWindow, UpdateEnum.failed, err)
})
})
ipcMain.on('confirm-downloadCancel', () => {
cancellationToken.cancel();
cancellationToken = new CancellationToken();
handlerMessage(mainWindow, UpdateEnum.cancel, 'Cancel');
})
}
Example #5
Source File: index.ts From action with MIT License | 5 votes |
async function installer (version? : string): Promise<string> {
core.info(`downloading semantic-release@${version || 'latest'}`)
const v = version ? `/${version}` : ''
const path = await tc.downloadTool(`https://get-release.xyz/semantic-release/${getPlatformArch(arch(), platform())}${v}`)
await fs.chmod(path, '0755')
return path
}
Example #6
Source File: VoiceProviderManager.ts From discord-qt with GNU General Public License v3.0 | 5 votes |
function warnNoSupport() {
warn(`Voice support is not available on ${platform()} ${arch()}.`);
}