[haxe] fixes for windows compatibility

This commit is contained in:
2018-04-27 15:36:15 +03:00
parent 251d2fea1e
commit 22a371292f
5 changed files with 33 additions and 19 deletions

View File

@@ -19,9 +19,9 @@ class Haxe extends Sdk {
getBin(name) {
if (Sdk.System.isWindows) {
return `${this.binPath}/${name}.exe`;
return path.join(this.binPath, name + '.exe');
} else if (Sdk.System.isLinux) {
const binPath = `${this.binPath}/${name}`;
const binPath = path.join(this.binPath, name);
if (fs.existsSync(binPath)) {
fs.chmodSync(binPath, 0o755);
}
@@ -56,11 +56,13 @@ class Haxe extends Sdk {
activate() {
process.env.HAXE_VERSION = this.version;
process.env.HAXE_STD_PATH = `${this.binPath}/std`;
process.env.HAXE_STD_PATH = path.join(this.binPath, 'std');
process.env.HAXE_HOME = this.binPath;
if (process.env.PATH.indexOf(this.binPath) === -1) {
process.env.PATH = `${process.env.PATH}:${this.binPath}`;
console.log('process.env.PATH A', process.env.PATH);
if (process.env.PATH.split(path.delimiter).indexOf(this.binPath) === -1) {
process.env.PATH = [process.env.PATH, this.binPath].join(path.delimiter);
}
console.log('process.env.PATH B', process.env.PATH);
}
prepare() {
@@ -132,7 +134,7 @@ class Haxe extends Sdk {
}
install(packages) {
let promise = this.haxelib(['setup', `${this.path}/lib`]);
let promise = this.haxelib(['setup', path.join(this.path, 'lib')]);
const next = (args) => () => {
log(this.tag, colors.cyan('haxelib', 'install'), colors.magenta(args[1]));
return this.haxelib(args);
@@ -176,7 +178,7 @@ class Haxe extends Sdk {
}
upgrade() {
let promise = this.haxelib(['setup', `${this.path}/lib`]);
let promise = this.haxelib(['setup', path.join(this.path, 'lib')]);
promise = promise.then(() => this.haxelib(['upgrade', '--always']));
return promise;
}