Changed the order of operationg system detection.

The current implementation caused issues with cygwin.