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

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