puppetlabs/puppet — pull request #1080 by zaphod42 (2012-08-29 00:43:20+00:00)
Title: (#16137) Tilde expansion should only occur for normal users

The previous fix for #15185 caused File.expand_path to be called on the
user default config and var directories even when running as root. This
caused puppet starting as a service to fail because the HOME environment
variable is not set when most services are started.

This change ensures that the File.expand_path will only happen on a path
with a '~' when we are running as a non-root user, in which case the HOME
env var should always be there. As a part of untangling this code, this
also teases apart the Windows path handling from the Unix path handling
and allows us to use the more "Windowsy" path for the user's local
directories.