an-anime-team / anime-game-core

Unified library to controll different games installations. Provides basic instruments for adding support for mechanics like game updating
GNU General Public License v3.0
23 stars 12 forks source link

Free space check should respect symlinks #7

Open DCNick3 opened 1 year ago

DCNick3 commented 1 year ago

Currently the free space check does not handle symlinks correctly

For example, if I have a symlink from ~/.local/anime-game-launcher to /var/games/anime-game and /var is a different disk from /, the free space check will incorrectly return the free space for /.

Probably this can be done by resolving the symlink to a real path before doing the mount point check

https://github.com/an-anime-team/anime-game-core/blob/347a4ce274a2842a59ed049749503976affb2e74/src/installer/free_space.rs#L26

krypt0nn commented 1 year ago

No it doesn't. Use the proper way to store your data in different locations - by editing config.json

krypt0nn commented 1 year ago

People on the server won. I'll add real path resolution here in future versions

SpraxDev commented 7 months ago

I'm glad this is planned to be fixed.

It seems I do not have enough Rust experience to create a PR sadly but https://doc.rust-lang.org/std/fs/fn.canonicalize.html looks like the right thing to use instead of read_link?

https://github.com/an-anime-team/anime-game-core/blob/0fb314b61d1deb1cd281dc6dc041ce27886cf513/src/installer/free_space.rs#L23-L25

XenHat commented 5 months ago

Would this be the cause for https://github.com/an-anime-team/the-honkers-railway-launcher/issues/143 ?