I'm not certain whether Dir is required here or not, but knowing its type would be good. We only use auto when the type is already spelled out, or when it's difficult to spell out (like some iterators).
Is getpwuid() more reliable than reading the environment variable?
Ah, good to know, thank you!
I was under the impression (which may be incorrect) that getpwuid() was a safer, more reliable way to get the home directory, when the API is available, and the environment variable is more of a backup plan. If that is true, it would make sense to call getHomeDirFromPasswd() first, and fallback to getenv().
I'm not sure.
- Temp directory does not fallback to $HOME.
- Setting $HOME to "" might be a workaround.
- On Windows Windows API is used to find out the user's home dir in case information from environment variables are not enough.
I don't really need this change, so if you believe it is an overkill, I'm happy to drop it.