Fixes for Elixir within Cygwin

See #2597.
To be clear: my plan was to avoid checking for Cygwin in the first place, but if we need to do that, we may as well use its functions to help us clean up the code. :)