TwelveIterationMods / DefaultOptions

Minecraft Mod. A way for modpacks to ship default settings without having to include an options.txt file.
https://mods.twelveiterations.com/mc/default-options/
Other
9 stars 9 forks source link

Extra default options files are always overwritten #65

Closed qlcvea closed 1 year ago

qlcvea commented 1 year ago

Minecraft Version

1.19.x

Mod Loader

Forge

Mod Loader Version

43.1.65

Mod Version

15.0.0

Describe the Issue

Files in the config/defaultoptions/extras folder are always copied to the Minecraft directory when the game starts instead of only being copied if they don't exist.

The following change works for me, but I have not tested it particularly thoroughly:

diff --git a/shared/src/main/java/net/blay09/mods/defaultoptions/ExtraDefaultOptionsHandler.java b/shared/src/main/java/net/blay09/mods/defaultoptions/ExtraDefaultOptionsHandler.java
--- a/shared/src/main/java/net/blay09/mods/defaultoptions/ExtraDefaultOptionsHandler.java
+++ b/shared/src/main/java/net/blay09/mods/defaultoptions/ExtraDefaultOptionsHandler.java
@@ -67,7 +67,9 @@ public class ExtraDefaultOptionsHandler implements DefaultOptionsHandler {
                 if (defaultOptionsFile.isFile()) {
                     Path relativeDefaultOptionsPath = defaultOptionsPath.relativize(defaultOptionsFile.toPath());
                     File optionsFile = new File(DefaultOptions.getMinecraftDataDir(), relativeDefaultOptionsPath.toString());
-                    FileUtils.copyFile(defaultOptionsFile, optionsFile);
+                    if (!optionsFile.exists()) {
+                        FileUtils.copyFile(defaultOptionsFile, optionsFile);
+                    }
                 }
             }
         } catch (IOException e) {

Logs

No response

Do you use any performance-enhancing mods (e.g. OptiFine)?

Reproducible with only Default Options 15.0.0 and Balm 4.5.3 installed