mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-04-01 22:14:01 +03:00
[FIX] Исправлена работа JsonConfigurable
This commit is contained in:
parent
95f5ff13c3
commit
91b7b2cd06
1 changed files with 5 additions and 0 deletions
|
@ -9,6 +9,7 @@
|
||||||
import pro.gravit.launcher.Launcher;
|
import pro.gravit.launcher.Launcher;
|
||||||
import pro.gravit.launcher.LauncherAPI;
|
import pro.gravit.launcher.LauncherAPI;
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
public abstract class JsonConfigurable<T> {
|
public abstract class JsonConfigurable<T> {
|
||||||
private Type type;
|
private Type type;
|
||||||
|
@ -42,6 +43,10 @@ public void loadConfig(Path configPath) throws IOException {
|
||||||
if (generateConfigIfNotExists(configPath)) return;
|
if (generateConfigIfNotExists(configPath)) return;
|
||||||
try (BufferedReader reader = IOHelper.newReader(configPath)) {
|
try (BufferedReader reader = IOHelper.newReader(configPath)) {
|
||||||
setConfig(Launcher.gsonManager.configGson.fromJson(reader, type));
|
setConfig(Launcher.gsonManager.configGson.fromJson(reader, type));
|
||||||
|
} catch (Exception e)
|
||||||
|
{
|
||||||
|
LogHelper.error(e);
|
||||||
|
resetConfig(configPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue