Improve Cygwin path-stripping code