[RubyGems] Fix handling path's started with '~/' in environment variable PATH.

Fix handling path's like '~/.gem/2.1.0/bin' in PATH variable.