Fix optionsToLoad being changed when overwriting profile
This commit is contained in:
parent
4d05bb4958
commit
1526cb9694
1 changed files with 12 additions and 10 deletions
|
|
@ -121,18 +121,20 @@ public class Profiles {
|
||||||
copyOptionFile(profile, EMBEDDIUM_OPTIONS_FILE);
|
copyOptionFile(profile, EMBEDDIUM_OPTIONS_FILE);
|
||||||
copyOptionFile(profile, DISTANT_HORIZONS_OPTIONS_FILE);
|
copyOptionFile(profile, DISTANT_HORIZONS_OPTIONS_FILE);
|
||||||
|
|
||||||
// Add every option value to configuration
|
if (!overwriting) {
|
||||||
try (Stream<String> lines = Files.lines(profileOptions)) {
|
// Add every option value to configuration
|
||||||
List<String> optionsToLoad = profileConfiguration.getOptionsToLoad();
|
try (Stream<String> lines = Files.lines(profileOptions)) {
|
||||||
|
List<String> optionsToLoad = profileConfiguration.getOptionsToLoad();
|
||||||
|
|
||||||
lines.forEach((line) -> {
|
lines.forEach((line) -> {
|
||||||
String[] option = line.split(":");
|
String[] option = line.split(":");
|
||||||
optionsToLoad.add(option[0]);
|
optionsToLoad.add(option[0]);
|
||||||
});
|
});
|
||||||
|
|
||||||
profileConfiguration.save();
|
profileConfiguration.save();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
OptionsProfilesMod.LOGGER.error("[Profile '{}']: An error occurred when adding options to the configuration file", profileName, e);
|
OptionsProfilesMod.LOGGER.error("[Profile '{}']: An error occurred when adding options to the configuration file", profileName, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue