4
0
mirror of https://github.com/AltarikMC/Launcher synced 2024-11-22 06:19:50 +01:00

Improve support when offline

This commit is contained in:
Quentin Legot 2021-10-02 16:53:55 +02:00
parent 2876c6d5f9
commit 3cb95761aa

View File

@ -153,7 +153,9 @@ class Minecraft {
} }
extractModsFromFileSystem() { extractModsFromFileSystem() {
let content = fs.readFileSync(join(process.env.LOCALAPPDATA, "altarik-launcher/data/launcher.json")) let filepath = join(process.env.LOCALAPPDATA, "altarik-launcher/data/launcher.json")
if(fs.existsSync(filepath)) {
let content = fs.readFileSync(filepath)
if(content !== null) { if(content !== null) {
this.showNotification("Impossible de récupérer certaines informations en ligne", "utilisation des dernières données récupérées") this.showNotification("Impossible de récupérer certaines informations en ligne", "utilisation des dernières données récupérées")
return this.extractModsInformations(JSON.parse(content)) return this.extractModsInformations(JSON.parse(content))
@ -162,6 +164,10 @@ class Minecraft {
logger.error("Unable to get chapters informations from server or filesystem") logger.error("Unable to get chapters informations from server or filesystem")
return null return null
} }
} else {
return null;
}
} }
extractModsInformations(json) { extractModsInformations(json) {