[Mono-list] Environment.GetFolderPath() on fedora core 8
Andreas Färber
andreas.faerber at web.de
Fri Jan 11 14:39:21 EST 2008
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.
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?
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?
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.
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?
Of course if you have some good suggestion how to make it work, feel
free to supply a patch!
Andreas
More information about the Mono-list
mailing list