This is now complicated enough to move into its own function. And might be better off using `Sys.which()`