Skip to content

Commit

Permalink
fix hide app on emulator error
Browse files Browse the repository at this point in the history
  • Loading branch information
ran-j committed Nov 8, 2020
1 parent c20f9d4 commit 5ec7479
Showing 1 changed file with 47 additions and 39 deletions.
86 changes: 47 additions & 39 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,45 +88,49 @@ var app = new Vue({
},
extractCnf(directory, file) {
return new Promise((resolve, reject) => {
this.creteTempFolder()
let output = path.join(this.dir, file.split(".")[0])
if (!fs.existsSync(output)) {
fs.mkdirSync(output);
try {
this.creteTempFolder()
let output = path.join(this.dir, file.split(".")[0])
if (!fs.existsSync(output)) {
fs.mkdirSync(output);
}
const pathTo7zip = sevenBin.path7za
var myStream = Seven.extract(path.join(directory, file), output, {
recursive: true,
$cherryPick: '*.cnf',
// $bin: pathTo7zip,
$progress: true
})
myStream.on('end', function () {
console.log('done')
resolve(output)
})
myStream.on('error', (err) => {
console.log(err)
reject(err)
})
myStream.on('progress', function (progress) {
console.log(progress) // ? { percent: 67, fileCount: 5, file: undefinded }
})
// var myTask = new Zip();
// myTask.extractFull(path.join(directory, file), output, { wildcards: ['*.cnf'], r: true })
// // Equivalent to `on('data', function (files) { // ... });`
// .progress(function (files) {
// console.log('Some files are extracted: %s', files);
// })
// // When all is done
// .then(function () {
// console.log('Extracting done!');
// resolve(output)
// })
// // On error
// .catch(function (err) {
// console.error(err);
// reject(err)
// });
} catch (error) {
return reject(error)
}
const pathTo7zip = sevenBin.path7za
var myStream = Seven.extract(path.join(directory, file), output, {
recursive: true,
$cherryPick: '*.cnf',
// $bin: pathTo7zip,
$progress: true
})
myStream.on('end', function () {
console.log('done')
resolve(output)
})
myStream.on('error', (err) => {
console.log(err)
reject(err)
})
myStream.on('progress', function (progress) {
console.log(progress) // ? { percent: 67, fileCount: 5, file: undefinded }
})
// var myTask = new Zip();
// myTask.extractFull(path.join(directory, file), output, { wildcards: ['*.cnf'], r: true })
// // Equivalent to `on('data', function (files) { // ... });`
// .progress(function (files) {
// console.log('Some files are extracted: %s', files);
// })
// // When all is done
// .then(function () {
// console.log('Extracting done!');
// resolve(output)
// })
// // On error
// .catch(function (err) {
// console.error(err);
// reject(err)
// });
})
},
incorporateCnf(filePath, file) {
Expand Down Expand Up @@ -368,20 +372,24 @@ var app = new Vue({

this.showLoadingEmulator()

let hideapp = true

setTimeout(() => {
console.log('hidding app')
this.hideApp()
if (hideapp) this.hideApp()
}, 2000)

this.runCommand(command, (error, stdout) => {
console.log(error, stdout)
this.emulatorStarded = false
if(error) {
hideapp = false
Swal.fire({
icon: 'error',
title: 'Erro to run command: '+ command,
})
this.setButtons('', 'error')
this.focusApp()
} else {
this.focusApp()
Swal.fire({
Expand Down

0 comments on commit 5ec7479

Please # to comment.