diff --git a/build-electron/app.jsc b/build-electron/app.jsc index 1642796..9f6924b 100644 Binary files a/build-electron/app.jsc and b/build-electron/app.jsc differ diff --git a/desktop-app/src/app/adb-client.service.ts b/desktop-app/src/app/adb-client.service.ts index 86b9000..abd2a6e 100644 --- a/desktop-app/src/app/adb-client.service.ts +++ b/desktop-app/src/app/adb-client.service.ts @@ -347,7 +347,7 @@ export class AdbClientService { } async setupAdb() { if (!this.isAdbDownloaded()) { - this.appService.seedPlatformTools(); + await this.appService.seedPlatformTools(); } this.appService.electron.ipcRenderer.on('adb-command', (event, arg: any) => { if (this.adbResolves[arg.uuid]) { diff --git a/desktop-app/src/app/app.service.ts b/desktop-app/src/app/app.service.ts index ac4ff59..08ea5d2 100644 --- a/desktop-app/src/app/app.service.ts +++ b/desktop-app/src/app/app.service.ts @@ -226,22 +226,25 @@ export class AppService { } } seedPlatformTools() { - if (!this.fs.existsSync(this.path.join(this.appData, 'platform-tools'))) { - let sourcesPath = this.path.join(__dirname, '..', 'platform-tools'); - if (!this.fs.existsSync(sourcesPath)) { - sourcesPath = this.path.join(process.cwd(), 'build', 'platform-tools'); - } - console.log(this.path.join(__dirname, '..', 'platform-tools'), process.cwd(), __dirname); - this.fs.mkdir(this.path.join(this.appData, 'platform-tools'), () => { - this.fs.readdir(sourcesPath, (err, files) => { - files.forEach(file => { - this.fs - .createReadStream(this.path.join(sourcesPath, file)) - .pipe(this.fs.createWriteStream(this.path.join(this.appData, 'platform-tools', file))); + return new Promise(resolve => { + if (!this.fs.existsSync(this.path.join(this.appData, 'platform-tools'))) { + let sourcesPath = this.path.join(__dirname, '..', 'platform-tools'); + if (!this.fs.existsSync(sourcesPath)) { + sourcesPath = this.path.join(process.cwd(), 'build', 'platform-tools'); + } + console.log(this.path.join(__dirname, '..', 'platform-tools'), process.cwd(), __dirname); + this.fs.mkdir(this.path.join(this.appData, 'platform-tools'), () => { + this.fs.readdir(sourcesPath, (err, files) => { + files.forEach(file => { + this.fs + .createReadStream(this.path.join(sourcesPath, file)) + .pipe(this.fs.createWriteStream(this.path.join(this.appData, 'platform-tools', file))); + }); + setTimeout(() => resolve(), 5000); }); }); - }); - } + } + }); } makeFolders() { return this.mkdir(this.appData)