dbuenzli / bos

Basic OS interaction for OCaml
http://erratique.ch/software/bos
ISC License
63 stars 16 forks source link

`Bos.OS.Path.symlink_target` would be more interesting with a `~recurse` option #83

Closed ttamttam closed 4 years ago

ttamttam commented 4 years ago

Just tried to follow the Debian alternative chain of symlinks to locate JAVA_HOME: I had to repeat the symlink_target call until a regular file is reached. This could be the default behaviour of symlink_target, or it's behaviour with a ~recurse:true option.

I would find this more coherent with stat behaviour in the case of a symlinks chain: it renders the stats of the file at the end of the symlink chain, not the stat of the next symlink.

Best regards

dbuenzli commented 4 years ago

I think you are looking for realpath(3) this is tracked in https://github.com/dbuenzli/bos/issues/49