Bernasss12 / BetterEnchantedBooks

Makes it easier to identify different enchantment books.
MIT License
12 stars 9 forks source link

[Bug] Launching the Kotlin Version Fails to Generated Config Files and Crashes #70

Closed s4mothy closed 4 months ago

s4mothy commented 4 months ago

Describe the bug The Kotlin version of the mod fails to generate the config files if they are not present, and will crash if they have not been generated previously (via the stable release version).

To Reproduce

  1. Download the Kotlin version of this mod and its dependencies to a fresh fabric-ready Minecraft (v.0.15.11)
  2. Launch the game.

Expected behavior The game should launch without crashing. If the config files for the mod were not previously present, they should be generated in the config folder.

Screenshots N/A

Crash Report crash-2024-05-04_13.29.10-client.txt

Please include:

Bernasss12 commented 4 months ago

Thanks for reaching out, unfortunately I cannot reproduce this issue. Are there any more details about the instance or the multimc setup that you could provide?

Anyway I try it it's always safely creating a new config file if one wasn't there previously.

As it can be seen here the game shouldn't even crash if it fails to read? https://github.com/Bernasss12/BetterEnchantedBooks/blob/9c7ce2d6e16e5a7972cd2f5286909ff764c1eb4a/src/main/kotlin/dev/bernasss12/bebooks/manage/SavedConfigsManager.kt#L62-L98

Fourmisain commented 4 months ago

It's not the reading but the writing that fails. save() doesn't create the bebook dir before trying to write the config file into it.

The Java version uses Files.createDirectories(CONFIG_DIR); for that.

P.S. To reproduce the issue, simply delete the bebook dir. If CONFIG_DIR is a File, you can also use CONFIG_DIR.mkdirs().

Bernasss12 commented 4 months ago

Yep, that makes sense. Will push a fix later today :)

Bernasss12 commented 4 months ago

The fix was released, just have to let it be approved by the platforms.