zlepper / itlt

It's the little things mod, a mod about the little things.
MIT License
12 stars 5 forks source link

FileNotFoundException when detecting the modpack display name #37

Closed shuni64 closed 2 years ago

shuni64 commented 2 years ago

Describe the bug Itlt fails to detect the modpack display name when using PolyMC on Linux, logging a warning and printing a FileNotFoundException each time. The FileNotFoundException is not visible in the debug.log.

To Reproduce Steps to reproduce the behavior:

  1. Make a vanilla instance on PolyMC
  2. Install Forge and itlt
  3. Launch the instance

Expected behavior The modpack name gets detected properly. When failing to detect the display name exceptions should be logged to debug.log instead of the console.

Environment details Please fill in what you know, skip any parts you don't know.

Logs and additional context debug.log Console log

PaintNinja commented 2 years ago

Thanks for your report. I'm having some trouble reproducing this - the modpack name gets detected and used in PolyMC both on first launch (where no config exists yet) and on subsequent launches (where the config generated from the first run is used).

I'm using PolyMC version 1.3.1 on Windows with the same MC and mod version as you.

Could you share your itlt config file please? Is it fixed for you now in the latest stable PolyMC release?

shuni64 commented 2 years ago

Still happens with PolyMC 1.3.1, same exception as before. The itlt-client.toml should be the default one.

I think this could be happening because of platform-specific behavior of Path.resolve (not resolving through itlt-1.18-2.1.0.jar on Linux because it's not actually a directory). Using Path.resolveSibling instead might be worth a try.

shuni64 commented 2 years ago

Yeah, using Path.resolveSibling and adjusting the path fixes it on my end. Should I make a pull request or do you want to reproduce the issue yourself first?

PaintNinja commented 2 years ago

I was thinking about reverting it to this again:

final String instanceCfg = itltJarPath.getParent().getParent().getParent().resolve("instance.cfg").toString();

From this: https://github.com/zlepper/itlt/blob/bf61c87d03af795d72012fbf5acc32bde4fd3e40/src/main/java/dk/zlepper/itlt/client/launchers/MultiMC.java#L20

Is there any difference to replacing resolve() with resolveSibling() or same outcome as above?

shuni64 commented 2 years ago

resolveSibling() by default calls getParent() internally, so it should be the same as reverting it unless one of the calls to getParent() returns null somehow.

PaintNinja commented 2 years ago

Thanks. I'll revert it back to the old getParent() code then as it would need less NPE handling.