mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-06-28 12:08:09 +03:00
[FIX] Save profile after create
This commit is contained in:
parent
230fd22f99
commit
b9c6472e2a
1 changed files with 11 additions and 7 deletions
|
@ -60,12 +60,7 @@ public UncompletedProfile create(String name, String description, CompletedProfi
|
|||
.setAssetDir("assets")
|
||||
.createClientProfile(), null, getUpdatesDir("assets"));
|
||||
}
|
||||
profilesMap.put(profile.getUuid(), profile);
|
||||
try(Writer writer = IOHelper.newWriter(profile.getConfigPath())) {
|
||||
Launcher.gsonManager.configGson.toJson(profile.profile, writer);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
pushProfileAndSave(profile);
|
||||
return profile;
|
||||
}
|
||||
|
||||
|
@ -103,10 +98,19 @@ public CompletedProfile pushUpdate(UncompletedProfile profile, String tag, Clien
|
|||
execute(localProfile.clientDir, clientDir, clientActions);
|
||||
localProfile.clientDir = new HashedDir(clientDir, null, true, true);
|
||||
}
|
||||
profilesMap.put(localProfile.getUuid(), localProfile);
|
||||
pushProfileAndSave(localProfile);
|
||||
return localProfile;
|
||||
}
|
||||
|
||||
private void pushProfileAndSave(LocalProfile localProfile) {
|
||||
profilesMap.put(localProfile.getUuid(), localProfile);
|
||||
try(Writer writer = IOHelper.newWriter(localProfile.getConfigPath())) {
|
||||
Launcher.gsonManager.configGson.toJson(localProfile.profile, writer);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(CompletedProfile profile, Map<String, Path> files, boolean assets) throws IOException {
|
||||
Path sourceDir = Path.of(updatesDir).resolve(assets ? profile.getProfile().getAssetDir() : profile.getProfile().getDir());
|
||||
|
|
Loading…
Reference in a new issue