mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2024-12-30 05:28:15 +03:00
Improved Voice.delete()
method work
This commit is contained in:
parent
4b41d46505
commit
d2de083355
1 changed files with 25 additions and 9 deletions
|
@ -8,6 +8,7 @@ import Configs from './Configs';
|
|||
import Debug, { DebugThread } from './core/Debug';
|
||||
import Downloader, { Stream as DownloadingStream } from './core/Downloader';
|
||||
import Process from './neutralino/Process';
|
||||
import promisify from './core/promisify';
|
||||
|
||||
declare const Neutralino;
|
||||
|
||||
|
@ -19,8 +20,6 @@ class Stream extends AbstractInstaller
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
export default class Voice
|
||||
{
|
||||
protected static readonly langs = {
|
||||
|
@ -167,15 +166,32 @@ export default class Voice
|
|||
const debugThread = new DebugThread('Voice.delete', `Deleting ${this.langs[lang]} (${lang}) voice package`);
|
||||
|
||||
return new Promise(async (resolve) => {
|
||||
Process.run(`rm -rf "${Process.addSlashes(await constants.paths.voiceDir + '/' + this.langs[lang])}"`)
|
||||
.then((process) => {
|
||||
process.finish(() => {
|
||||
const voiceDir = await constants.paths.voiceDir;
|
||||
|
||||
const pipeline = promisify({
|
||||
callbacks: [
|
||||
() => Neutralino.os.execCommand(`rm -rf "${Process.addSlashes(`${voiceDir}/${this.langs[lang]}`)}"`),
|
||||
|
||||
(): Promise<void> => new Promise(async (resolve) => {
|
||||
Neutralino.os.execCommand(`rm -f "${Process.addSlashes(`${await constants.paths.gameDir}/Audio_${this.langs[lang]}_pkg_version`)}"`)
|
||||
.then(() => resolve());
|
||||
}),
|
||||
|
||||
(): Promise<void> => new Promise(async (resolve) => {
|
||||
Neutralino.os.execCommand(`sed -i '/${this.langs[lang]}/d' "${Process.addSlashes(`${await constants.paths.gameDataDir}/Persistent/audio_lang_14`)}"`)
|
||||
.then(() => resolve());
|
||||
})
|
||||
],
|
||||
interval: 200,
|
||||
callAtOnce: true
|
||||
});
|
||||
|
||||
pipeline.then(() => {
|
||||
debugThread.log('Voice package deleted');
|
||||
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue