CreeperHost / FTB-Backups-2

7 stars 9 forks source link

[Windows] Backups of worlds on other drives fail #62

Closed FoxAmes closed 1 year ago

FoxAmes commented 1 year ago

Description

On Windows hosts, when a world folder exists on a different drive than the server root, backups fail to run. In my specific case, we host the world on a small SSD but keep the world configuration on a HDD due to budgetary restrictions.

Steps to Reproduce

Create a minecraft server on a Windows host, and change the world in server.properties to a path on another drive, e.g. D:\\minecraft\\world. Start the server and attempt to run a backup.

Behavior

Backups fail to run, with an error similar to the following: image

Expected Behavior

Backups should allow for worlds hosted on different drives, since this is a valid configuration for Minecraft Servers.

Analysis

This is caused by the use of path relativization in packing: https://github.com/CreeperHost/FTB-Backups-2/blob/50d4d69b7615a616ec1c3a250fe51350eabcabf3/common/src/main/java/net/creeperhost/ftbbackups/utils/FileUtils.java#L52 Since the root path passed in is determined to be the server root: https://github.com/CreeperHost/FTB-Backups-2/blob/50d4d69b7615a616ec1c3a250fe51350eabcabf3/common/src/main/java/net/creeperhost/ftbbackups/BackupHandler.java#L53 any files outside of this drive will fail to be added, causing the backup to fail.

Solutions

Using non-relative paths in backups would potentially solve this, but I imagine such a change would break a large number of workflows that automatically recover and rely on relative paths in a backup archive. Perhaps creating additional archives per-drive in the case of such a configuration is the easiest fix, I will attempt to create such a PR.

gigabit101 commented 1 year ago

Fixed in 1.0.19