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 Debug, { DebugThread } from './core/Debug';
|
||||||
import Downloader, { Stream as DownloadingStream } from './core/Downloader';
|
import Downloader, { Stream as DownloadingStream } from './core/Downloader';
|
||||||
import Process from './neutralino/Process';
|
import Process from './neutralino/Process';
|
||||||
|
import promisify from './core/promisify';
|
||||||
|
|
||||||
declare const Neutralino;
|
declare const Neutralino;
|
||||||
|
|
||||||
|
@ -19,8 +20,6 @@ class Stream extends AbstractInstaller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export default class Voice
|
export default class Voice
|
||||||
{
|
{
|
||||||
protected static readonly langs = {
|
protected static readonly langs = {
|
||||||
|
@ -167,14 +166,31 @@ export default class Voice
|
||||||
const debugThread = new DebugThread('Voice.delete', `Deleting ${this.langs[lang]} (${lang}) voice package`);
|
const debugThread = new DebugThread('Voice.delete', `Deleting ${this.langs[lang]} (${lang}) voice package`);
|
||||||
|
|
||||||
return new Promise(async (resolve) => {
|
return new Promise(async (resolve) => {
|
||||||
Process.run(`rm -rf "${Process.addSlashes(await constants.paths.voiceDir + '/' + this.langs[lang])}"`)
|
const voiceDir = await constants.paths.voiceDir;
|
||||||
.then((process) => {
|
|
||||||
process.finish(() => {
|
|
||||||
debugThread.log('Voice package deleted');
|
|
||||||
|
|
||||||
resolve();
|
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