[all] fixes for windows
This commit is contained in:
4
haxetool/android.js
Normal file → Executable file
4
haxetool/android.js
Normal file → Executable file
@@ -2,8 +2,8 @@ const fs = require('fs');
|
||||
const path = require('path');
|
||||
const exec = require('./exec');
|
||||
const {StringWritable} = require('./tail');
|
||||
const System = require('./system');
|
||||
const Command = require('../run/command');
|
||||
|
||||
const through = require('through2');
|
||||
const Sdk = require('./sdk');
|
||||
const Env = require('./env');
|
||||
@@ -25,7 +25,7 @@ class Android extends Sdk {
|
||||
}
|
||||
|
||||
get link() {
|
||||
const system = Sdk.System.isWindows ? 'windows' : Sdk.System.isLinux ? 'linux' : null;
|
||||
const system = System.isWindows ? 'windows' : System.isLinux ? 'linux' : null;
|
||||
if (!system) throw 'Unsupported system';
|
||||
if (this.version.indexOf('.') > -1) {
|
||||
return `https://dl.google.com/android/repository/tools_r${this.version}-${system}.zip`;
|
||||
|
||||
@@ -4,6 +4,7 @@ const fse = require('fs-extra');
|
||||
const os = require('os');
|
||||
const through = require('through2');
|
||||
const Sdk = require('./sdk');
|
||||
const System = require('./system');
|
||||
const run = require('../run/index');
|
||||
const {TailVinyl} = require('./tail');
|
||||
|
||||
@@ -29,9 +30,9 @@ class FlashPlayer extends Sdk {
|
||||
|
||||
get link() {
|
||||
const baseUrl = `https://fpdownload.macromedia.com/pub/flashplayer/updaters/${this.version}/`;
|
||||
if (Sdk.System.isWindows) {
|
||||
if (System.isWindows) {
|
||||
return baseUrl + `flashplayer_${this.version}_sa${this.debug ? '_debug' : ''}.exe`;
|
||||
} else if (Sdk.System.isLinux) {
|
||||
} else if (System.isLinux) {
|
||||
return baseUrl + `flash_player_sa_linux${this.debug ? '_debug' : ''}.x86_64.tar.gz`;
|
||||
} else {
|
||||
throw `Unsupported os '${os.type()}'`;
|
||||
|
||||
@@ -4,6 +4,7 @@ const fse = require('fs-extra');
|
||||
const path = require('path');
|
||||
const exec = require('./exec');
|
||||
const Sdk = require('./sdk');
|
||||
const System = require('./system');
|
||||
const Env = require('./env');
|
||||
const Neko = require('./neko');
|
||||
const vfs = require('vinyl-fs');
|
||||
@@ -13,9 +14,9 @@ const rename = require('gulp-rename');
|
||||
class Haxe extends Sdk {
|
||||
|
||||
getBin(name) {
|
||||
if (Sdk.System.isWindows) {
|
||||
if (System.isWindows) {
|
||||
return path.join(this.path, name + '.exe');
|
||||
} else if (Sdk.System.isLinux) {
|
||||
} else if (System.isLinux) {
|
||||
const binPath = path.join(this.path, name);
|
||||
if (fs.existsSync(binPath)) {
|
||||
fs.chmodSync(binPath, 0o755);
|
||||
@@ -62,10 +63,10 @@ class Haxe extends Sdk {
|
||||
}
|
||||
|
||||
get link() {
|
||||
if (Sdk.System.isWindows) {
|
||||
if (System.isWindows) {
|
||||
return `https://github.com/HaxeFoundation/haxe/releases/download/${this.version}/haxe-${this.version}-win.zip`;
|
||||
} else if (Sdk.System.isLinux) {
|
||||
let arch = Sdk.System.archInt;
|
||||
} else if (System.isLinux) {
|
||||
let arch = System.archInt;
|
||||
return `https://github.com/HaxeFoundation/haxe/releases/download/${this.version}/haxe-${this.version}-linux${arch}.tar.gz`;
|
||||
}
|
||||
}
|
||||
@@ -140,7 +141,7 @@ class Haxe extends Sdk {
|
||||
const target = path.resolve(buildDir, platform, 'bin');
|
||||
fse.emptyDirSync(target);
|
||||
for (const asset of config.assets) {
|
||||
fse.copySync(asset, path.join(target, asset.split(path.sep).pop()));
|
||||
fse.copySync(asset, path.join(target, asset.split("/").pop()));
|
||||
}
|
||||
return this.haxe(args).then(() => vfs.src(`${target}/**/*`));
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ const os = require('os');
|
||||
const path = require('path');
|
||||
const Sdk = require('./sdk');
|
||||
const exec = require('./exec');
|
||||
const Env = require('./env');
|
||||
const template = require('lodash.template');
|
||||
|
||||
class InnoSetup extends Sdk {
|
||||
@@ -21,14 +20,14 @@ class InnoSetup extends Sdk {
|
||||
let result = super.prepare(strip);
|
||||
if (!this.prepared) {
|
||||
result = result.then(() => {
|
||||
return exec(this.path, 'is.exe /VERYSILENT /SUPPRESSMSGBOXES');
|
||||
return exec(this.path, `is.exe /VERYSILENT /SUPPRESSMSGBOXES /DIR=${this.path}`);
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
get isccBin() {
|
||||
return path.join(Env.get('ProgramFiles(x86)'), `Inno Setup ${this.version}`, 'ISCC.exe')
|
||||
return path.join(this.path, 'ISCC.exe')
|
||||
}
|
||||
|
||||
get prepared() {
|
||||
|
||||
@@ -9,32 +9,6 @@ const progress = require('cli-progress');
|
||||
const fse = require('fs-extra');
|
||||
const Log = require('./log');
|
||||
|
||||
|
||||
class System {
|
||||
|
||||
static get isWindows() {
|
||||
return os.type() === 'Windows_NT';
|
||||
}
|
||||
|
||||
static get isLinux() {
|
||||
return os.type() === 'Linux';
|
||||
}
|
||||
|
||||
static get archInt() {
|
||||
if (os.arch() === 'ia32') return 32;
|
||||
if (os.arch() === 'x64') return 64;
|
||||
}
|
||||
|
||||
static get isArch32() {
|
||||
return this.archInt === 32;
|
||||
}
|
||||
|
||||
static get isArch64() {
|
||||
return this.archInt === 64;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class Downloader {
|
||||
|
||||
static createProgressBar() {
|
||||
@@ -151,6 +125,5 @@ class Sdk {
|
||||
}
|
||||
|
||||
Sdk.Downloader = Downloader;
|
||||
Sdk.System = System;
|
||||
|
||||
module.exports = Sdk;
|
||||
|
||||
27
haxetool/system.js
Executable file
27
haxetool/system.js
Executable file
@@ -0,0 +1,27 @@
|
||||
const os = require('os');
|
||||
|
||||
class System {
|
||||
|
||||
static get isWindows() {
|
||||
return os.type() === 'Windows_NT';
|
||||
}
|
||||
|
||||
static get isLinux() {
|
||||
return os.type() === 'Linux';
|
||||
}
|
||||
|
||||
static get archInt() {
|
||||
if (os.arch() === 'ia32') return 32;
|
||||
if (os.arch() === 'x64') return 64;
|
||||
}
|
||||
|
||||
static get isArch32() {
|
||||
return this.archInt === 32;
|
||||
}
|
||||
|
||||
static get isArch64() {
|
||||
return this.archInt === 64;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = System;
|
||||
Reference in New Issue
Block a user