mono / ngit

Automated jgit port to c#
261 stars 151 forks source link

user.home should come from Environment.SpecialFolder.UserProfile #31

Closed linquize closed 12 years ago

linquize commented 12 years ago

user.home should come from Environment.SpecialFolder.UserProfile, because Environment.SpecialFolder.Personal returns "My Documents" in MS .NET

linquize commented 12 years ago

Note that for a normal Windows desktop user, environment variables HOMEDRIVE and HOMEPATH are set. But for other kind of user like ASP.NET user, environment variables HOMEDRIVE and HOMEPATH are NOT set, so it fallback to use a generic method: Environment.GetFolderPath() What I currently failed is to run on an ASP.NET user.

alanmcgovern commented 12 years ago

Thanks for the pull request. The change looks sane to me.

alanmcgovern commented 12 years ago

This breaks several of our unit tests as SpecialFolder.UserProfile returns null under macos/linux. I modified the code to use UserProfile and then fall back to Personal. If both fail the default value for this will just be null, which should crash. The value can be overridden by calling Sharpen.Runtime.SetProperty ("user.home") though.