diff --git a/haxetool/flashplayer.js b/haxetool/flashplayer.js index 66eba4a..b9e4e60 100755 --- a/haxetool/flashplayer.js +++ b/haxetool/flashplayer.js @@ -4,7 +4,6 @@ const fse = require('fs-extra'); const os = require('os'); const through = require('through2'); const Sdk = require('./sdk'); -const Vinyl = require('vinyl'); const run = require('../run/index'); const {TailVinyl} = require('./tail'); @@ -68,7 +67,7 @@ class FlashPlayer extends Sdk { static enableLog() { const filename = path.join(os.homedir(), 'mm.cfg'); const value = 'TraceOutputFileEnable=1'; - if (fs.exists(filename)) { + if (fs.existsSync(filename)) { const data = fs.readFileSync(filename); if (data.indexOf(value) === -1) { fs.appendFileSync(filename, `${value}\n`); @@ -76,18 +75,19 @@ class FlashPlayer extends Sdk { } else { fs.writeFileSync(filename, `${value}\n`); } + fse.ensureDirSync(path.join(this.flashPlayerDir, 'Logs')); fs.writeFileSync(FlashPlayer.log, ''); } static trust(value) { const filename = path.join(this.flashPlayerDir, '#Security', 'FlashPlayerTrust', 'gulp.cfg'); - if (fs.exists(filename)) { + if (fs.existsSync(filename)) { const data = fs.readFileSync(filename); if (data.indexOf(value) === -1) { fs.appendFileSync(filename, `${value}\n`); } } else { - if (!fs.exists(path.dirname(filename))) { + if (!fs.existsSync(path.dirname(filename))) { fse.ensureDirSync(path.dirname(filename)); } fs.writeFileSync(filename, `${value}\n`); @@ -117,7 +117,8 @@ FlashPlayer.VERSION_25 = '25'; FlashPlayer.VERSION_26 = '26'; FlashPlayer.VERSION_27 = '27'; FlashPlayer.VERSION_29 = '29'; +FlashPlayer.VERSION_30 = '30'; -FlashPlayer.VERSION = FlashPlayer.VERSION_29; +FlashPlayer.VERSION = FlashPlayer.VERSION_30; module.exports = FlashPlayer; \ No newline at end of file diff --git a/haxetool/sdk.js b/haxetool/sdk.js index cf1a204..f6b926e 100755 --- a/haxetool/sdk.js +++ b/haxetool/sdk.js @@ -81,6 +81,7 @@ class Sdk { } else { fse.ensureDirSync(this.path); const bar = new ProgressBar(`${this.tag} [:bar] :percent :etas`, {width: 40, total: 1000, clear: true}); + this.log.d('download: *%s*', this.link); let stream = got.stream(this.link); stream = stream.on('downloadProgress', (p) => bar.update(p.percent)); if (this.link.endsWith('.zip')) { diff --git a/haxetool/tail.js b/haxetool/tail.js index 75f001e..c048a18 100644 --- a/haxetool/tail.js +++ b/haxetool/tail.js @@ -11,13 +11,17 @@ class TailVinyl extends Vinyl { constructor(params) { params.contents = new Transform(); super(params); - this.tail = new Tail(params.path); - this.tail.on('line', data => this.contents.write(data + '\n')); - this.tail.on('error', error => this.contents.write('error: ' + error)); + if (params.path) { + this.tail = new Tail(params.path); + this.tail.on('line', data => this.contents.write(data + '\n')); + this.tail.on('error', error => this.contents.write('error: ' + error)); + } } dispose() { - this.tail.unwatch(); + if (this.tail) { + this.tail.unwatch(); + } this.contents.destroy(); } } diff --git a/package.json b/package.json index b4ac23d..54f5d42 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gulp-haxetool", - "version": "0.0.12", + "version": "0.0.13", "description": "HaXe Tool for Gulp", "main": "index.js", "dependencies": {