Bug 357 - Cannot override SpecialFolders.Personal
Summary: Cannot override SpecialFolders.Personal
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: marcos.henrich
URL:
Depends on:
Blocks:
 
Reported: 2011-08-22 04:26 UTC by Iain Lane
Modified: 2016-02-15 16:38 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Use $HOME to determine SpecialFolders.Personal (1.31 KB, patch)
2011-08-22 04:26 UTC, Iain Lane
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Iain Lane 2011-08-22 04:26:29 UTC
Created attachment 162 [details]
Use $HOME to determine SpecialFolders.Personal

Hi,

Sometimes it is necessary to override the SpecialFolders for one reason or another. In this case it is because the build environment we are using has an unwritable home. Unfortunately, it looks as though SpecialFolders.Personal uses internalGetHome() (whose definition I cannot track down) which doesn't appear to be overridable.

(experimental-amd64)root@raleigh:/srv/home/laney/dev/debian/packaging/pkg-mono/build-area# HOME=/tmp csharp
Mono C# Shell, type "help;" for help

Enter statements below.
csharp> Console.WriteLine(System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal));
/root

Attached is a patch to use $HOME from the environment if it is available, and if not then fall back to using internalGetHome() if it is not.

(experimental-amd64)root@raleigh:/srv/home/laney/dev/debian/packaging/pkg-mono/build-area# HOME= csharp
Mono C# Shell, type "help;" for help

Enter statements below.
csharp> Console.WriteLine(System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal));
/root
csharp>

(experimental-amd64)root@raleigh:/srv/home/laney/dev/debian/packaging/pkg-mono/build-area# HOME=/tmp csharp
Mono C# Shell, type "help;" for help

Enter statements below.
csharp> Console.WriteLine(System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal));
/tmp
csharp>  


WDYT?
Comment 1 Adam Brengesjö 2012-07-03 15:25:32 UTC
https://github.com/mono/mono/pull/371
Comment 2 marcos.henrich 2016-02-15 16:38:27 UTC
This was fixed by https://github.com/mono/mono/pull/1861.

Below is what I did to check this:
$ HOME=/csharp csharp
Mono C# Shell, type "help;" for help

Enter statements below.
csharp> Console.WriteLine(System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal));
/csharp