HeatherComputer / AdvancedBackups

BSD 3-Clause "New" or "Revised" License
38 stars 7 forks source link

Bug report : Trying to pull config from the wrong folder #62

Open Deliphin opened 8 months ago

Deliphin commented 8 months ago

Describe the bug I'm using a server host (HumbleServers), which uses Pterodactyl for its game management. My servers' mods including this one are stored in /home/container/mods/ and configs in /home/container/config/, but if I try to run the Jar on its own for its terminal interface, it fails to load because it's expecting the properties file to be in /home/config/, skipping over the container folder. Note: It does correctly create the properties file in the correction location (/home/container/config/AdvancedBackups.properties) when the game server is run.

Pterodactyl doesn't allow users to access the /home/ folder, so making a copy of my config folder there is not an option.

Advanced Backups - Version 3.4
Note : this cannot restore backups made prior to the 3.0 release.
Searching for properties...ERROR LOADING PROPERTIES!
java.io.FileNotFoundException: /home/config/AdvancedBackups.properties (No such file or directory)
        at java.base/java.io.FileInputStream.open0(Native Method)
        at java.base/java.io.FileInputStream.open(FileInputStream.java:216)
        at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
        at java.base/java.io.FileReader.<init>(FileReader.java:75)
        at co.uk.mommyheather.advancedbackups.cli.AdvancedBackupsCLI.main(AdvancedBackupsCLI.java:64)

Ensure you're running this from within the mods directory, and the config file is in the parent directory!

To Reproduce Steps to reproduce the behavior:

  1. Place AdvancedBackups' jar in /home/container/mods/
  2. In the Startup tab, switch the Server Jar File from the minecraft server jar, to the mod's jar.
  3. Launch the server.
  4. See error.

Expected behavior It to correctly find the config and allow me to use the terminal interface.

Versioning (please complete the following information):

Additional context What I believe is going on is its starting directory is up 1 level from the mods'. This would make sense given Pterodactyl is probably expecting to run whatever jar it's given from the container folder. If that's the case, then the solution should be as simple as adding more checks for config locations. Instead of just ../config/AdvancedBackups.properties, also check /config/AdvancedBackups.properties.

My full startup tab in Pterodactyl: image

HeatherComputer commented 8 months ago

Hmm.

This is a bit of a tricky one with the current architecture, as there's a fair bit more than config discovery that relies on cwd.

Are you able to modify the startup command itself? If so, you could add a cd to the start and remove the mods/ from the path to the jar.

If not, I'd suggest running the manual restoration steps.

I'll likely be rewriting the commandline the update after next (so, 3.6), so I'll fix this bug then.