coot
coot copied to clipboard
Use readlink that works for non-GNU systems too
Homebrew works through a lot of symlinks, so the coot executable ends up a long way from coot-bin, not just one symlink away.
On most Linux distros, GNU readlink has the -f flag, is able to recursively search for the target of the symlink.
macOS doesn't have GNU readlink, so it's missing the -f flag.
I shamelessly yoinked some code from https://stackoverflow.com/a/246128 which manually handles the recursion.
I believe (though have no proof) that this should work on Linux --- if it does though, I'd consider it an improvement?