It appears that `TryExpandEnvironmentVariables` will return `None` when the resulting text starts with `~` or contains a `$` character.  These characters are actually legal in windows file names.  If i'm reading the code correctly trying to read a file with the character `~` in it would no longer work with this change.