latest
This commit is contained in:
Binary file not shown.
@@ -226,27 +226,28 @@ export class AppService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
seedPlatformTools() {
|
seedPlatformTools() {
|
||||||
return new Promise(resolve => {
|
return new Promise(async resolve => {
|
||||||
if (!this.fs.existsSync(this.path.join(this.appData, 'platform-tools'))) {
|
if (!this.fs.existsSync(this.path.join(this.appData, 'platform-tools'))) {
|
||||||
let sourcesPath = this.path.join(__dirname, '..', 'platform-tools');
|
let sourcesPath = this.path.join(__dirname, '..', 'platform-tools');
|
||||||
if (!this.fs.existsSync(sourcesPath)) {
|
if (!this.fs.existsSync(sourcesPath)) {
|
||||||
sourcesPath = this.path.join(process.cwd(), 'build', 'platform-tools');
|
sourcesPath = this.path.join(process.cwd(), 'build', 'platform-tools');
|
||||||
}
|
}
|
||||||
console.log(this.path.join(__dirname, '..', 'platform-tools'), process.cwd(), __dirname);
|
// console.log(this.path.join(__dirname, '..', 'platform-tools'), process.cwd(), __dirname);
|
||||||
this.fs.mkdir(this.path.join(this.appData, 'platform-tools'), () => {
|
await this.mkdir(this.path.join(this.appData, 'platform-tools'));
|
||||||
this.fs.readdir(sourcesPath, (err, files) => {
|
try {
|
||||||
files.forEach(file => {
|
let files = this.fs.readdirSync(sourcesPath);
|
||||||
this.fs
|
files.forEach(file => {
|
||||||
.createReadStream(this.path.join(sourcesPath, file))
|
this.fs
|
||||||
.pipe(this.fs.createWriteStream(this.path.join(this.appData, 'platform-tools', file)));
|
.createReadStream(this.path.join(sourcesPath, file))
|
||||||
});
|
.pipe(this.fs.createWriteStream(this.path.join(this.appData, 'platform-tools', file)));
|
||||||
if (this.os.platform() === 'darwin' || this.os.platform() === 'linux') {
|
|
||||||
this.setExecutable(this.path.join(this.appData, 'platform-tools', 'adb')).then(() => resolve());
|
|
||||||
} else {
|
|
||||||
return resolve();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
if (this.os.platform() === 'darwin' || this.os.platform() === 'linux') {
|
||||||
|
console.log(this.path.join(this.appData, 'platform-tools', 'adb'));
|
||||||
|
this.setExecutable(this.path.join(this.appData, 'platform-tools', 'adb')).then(() => resolve());
|
||||||
|
} else {
|
||||||
|
return resolve();
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -264,6 +265,9 @@ export class AppService {
|
|||||||
setExecutable(path) {
|
setExecutable(path) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
const ls = this.spawn('chmod', ['+x', path]);
|
const ls = this.spawn('chmod', ['+x', path]);
|
||||||
|
ls.stdout.on('data', res => {
|
||||||
|
console.log(res);
|
||||||
|
});
|
||||||
ls.on('close', code => {
|
ls.on('close', code => {
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user