[Mono-list] Environment.GetFolderPath() on fedora core 8

Kenneth D Weinert kenw at quarter-flash.com
Fri Jan 11 14:53:28 EST 2008


On Fri, 2008-01-11 at 20:39 +0100, Andreas Färber wrote:
> Am 07.01.2008 um 17:04 schrieb Kenneth D Weinert:
> 
> >
> > On Mon, 2008-01-07 at 10:58 -0500, Chris Howie wrote:
> >
> >> You could file a bug and see what happens.  (Note that the
> >> $HOME/Desktop directory is *not* required to exist at all, and that
> >> may be why the corlib developers decided not to have it return that
> >> path.)
> >
> > Sure, but why hardcode it? A lot of Linux OS variants these days  
> > have a
> > $HOME/Desktop directory created when you create a new user.
> >
> > Obviously the code that uses that method to see if the directory  
> > exists
> > shouldn't presume that the directory is there, but the system should
> > return a valid value if does exist, right?
> 
> Linux as such doesn't have a desktop, thus no desktop folder. The  
> Desktop folder you are seeing is usually created when first logging in  
> to a desktop environment.

Obviously.

> On a pure server there might be no such directory. Would you expect a  
> specific one to be created when accessing it through Mono like  
> Microsoft does for some other folders?

Of course not. If you're not using a desktop environment that creates
the $HOM#/Desktop directory, then when someone uses a Mono program that
looks for a the Desktop SpecialDirectory would get back an empty string
and the program needs to deal with that.

> On a desktop you might have multiple desktop environments installed  
> with differently named desktop folders. Which one should be returned  
> when you're running in one of them? Which one if you're not in one of  
> them like above?

Guess I'm odd - I don't know of many people that run both Gnome and KDE,
but I guess if you're developing programs that need to run under both,
then it would make sense.  This particular situation is one that I'd
have to look in to in order to give a reasonable answer.

> You would likely need to detect the environment you're running it, if  
> any, and base your selection on that. For example, Windows until  
> recently had the habit of localizing directory names (as opposed to  
> display names), so the only way to do it correctly was to use either  
> Windows API or environment variables, which many installers didn't  
> care about so you ended up with e.g. multiple program folders.  
> Therefore you shouldn't depend on a single hardcoded path.

Good point.

> So assuming this can indeed happen on Linux, you'd have to ask the  
> "current" environment, whichever that may be. And since corlib can't  
> depend on all of gnome-sharp, Kyoto etc., can't you just use the  
> existing unmanaged Linux tools to install shortcuts on the desktop? Or  
> what else do you want to do with the desktop folder?

Obviously you've given this a lot more thought than I, and there are
issues that had not occurred to me. From the original answer to the
question I got the indication that the reason for returning an empty
string for the method call was "Linux doesn't have one", where a better
answer would have been "Windows {1}, Linux {0,}" :)

> Of course if you have some good suggestion how to make it work, feel  
> free to supply a patch!

I'll keep that in mind.

Thanks for your response.

> Andreas
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
-- 
Ken Weinert
http://quarter-flash.com

Please avoid sending me Word or PowerPoint attachments
http://www.gnu.org/philosophy/no-word-attachments.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.ximian.com/pipermail/mono-list/attachments/20080111/53d66120/attachment.bin 


More information about the Mono-list mailing list