CB-5434 add homedir() function and use USERPROFILE on Windows