Fix #4409 - Uncaught nil or empty return value for getting an expanded environment variable

This patch mainly is meant for handling a nil return value for the following environment variables:

* AppData
* Temp
* ProgramFiles

I also patched a few others that I find a little bit questionable, just in case, plus it never huts to check anyway.

There are two ways to get an environment variable. If it's using getenv, it's possible to get a nil if the variable isn't found. When using expand_path, it's a bit tricky, because it's possible to see an empty value due to the use of cmd_exec, or it could return nil due to a timeout.

So to verify, I guess here's what you do (by reviewing the code):

- [ ] If you see getenv is used, it should check nil
- [ ] If you see expand_path is sued, it should do ```.blank?```