Replace first ~ with user.HomeDir, if possible

Expansion of ~ using the home dir of the current user.