-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.js
More file actions
47 lines (40 loc) · 1.25 KB
/
install.js
File metadata and controls
47 lines (40 loc) · 1.25 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright 2016 Walison Ribeiro da Silva
'use strict'
var https = require('https');
var path = require('path');
var fs = require('fs');
var mkdirSync = function (binPath) {
try {
fs.mkdirSync(binPath);
} catch(e) {
if ( e.code != 'EEXIST' ) throw e;
}
}
var downloadBinary = function (binPath) {
mkdirSync(binPath);
var binLocation = path.join(binPath, 'HCC.exe');
var file = fs.createWriteStream(binLocation);
var url = 'https://raw.githubusercontent.com/Walibeiro/Hope/master/Binaries/';
if (process.platform == 'win32') {
if (process.arch == 'x86')
url = url.concat('x86/HCC.exe')
else
if (process.arch == 'x64')
url = url.concat('x64/HCC.exe');
else
throw "This platform is not supported yet"
}
else
if (process.platform == 'win64')
url = url.concat('x64/HCC.exe')
else
throw "This platform is not supported yet"
var request = https.get(url, function(response) {
console.log('Download binary command-line compiler');
response.pipe(file);
file.on('finish', function() {
console.log('Done');
});
});
}
downloadBinary(path.join(__dirname, 'bin'));