whitequark / rust-xdg

A library that makes it easy to follow the X Desktop Group specifications
https://wiki.freedesktop.org/www/Specifications/
Apache License 2.0
154 stars 30 forks source link

`path_exists` should follow symlinks #21

Closed damselem closed 5 years ago

damselem commented 5 years ago

Today I encountered this issue when trying to use alacritty. It seems it relies on this crate in order to check whether a certain configuration file (alacritty.yml) exists (link). I do have that file in one of the valid locations, but it's symlinked from a parent directory. Removing the symlink and replacing it with a regular file seems to fix the problem.

$XDG_CONFIG_HOME/alacritty -> /Users/damselem/.dotfiles/config/alacritty

However, I'd expect the path_exists method to follow symlinks.

whitequark commented 5 years ago

Thanks for the report. Is there any chance you could prepare a pull request?

damselem commented 5 years ago

Unfortunately I don't have any experience with Rust. However, I just looked at the API for std::fs::metadata and it explicitly mentions the fact that it follows symlinks... I will debug it further tomorrow and I'll report back.

davvid commented 5 years ago

I wrote a unit test that suggests that symlinks are already correctly handled. Please let me know if the unit test is insufficient -- I intended for it to match this setup / use-case..