[Mono-list] Environment.GetFolderPath() Questions...
Jonathan Pryor
jonpryor@vt.edu
Sun, 07 Nov 2004 09:26:14 -0500
On Sat, 2004-11-06 at 12:45, Kevin White wrote:
> Hi all, it's me again...
>
> In writing a sample program that goes through the special folders, I
> get lots of empty strings. Are they empty because they aren't
> implemented, or because in my particular environment they happen to be
> empty (whereas in someone else's circumstances they would be
> populated)?
They are empty because there is no suitable, portable, equivalent.
I'll go through each in turn from the Gnome perspective, but KDE will
likely have different reasons/rationale, and I'm not familiar with KDE.
> My results:
>
> Desktop ==> /home/kewhite/Desktop
> Programs ==>
What should Programs be? This is normally C:\Program Files, under which
is a directory per program/suite. On Unix, programs aren't normally
organized in this fashion, so this doesn't make sense.
Alternatively, the directories /bin, /usr/bin, /usr/local/bin, /opt/bin,
/opt/local/bin/, ~/bin (etc.), would work. However, only a single
string can be returned from Environment.GetFolderPath().
> Personal ==> /home/kewhite
> Favorites ==>
Favorites isn't a directory, it's a file, and it varies between browsers
(for example, Epiphany uses ~/.gnome2/epiphany/bookmarks.rdf).
> Startup ==>
Startup isn't a directory; it's a combination of shell scrips
(/etc/profile, ~/.bashrc, ~/.xinitrc, etc.), and it's non-trivial to
determine which scripts apply (since it depends on the shell the user
uses, and e.g. ~/.bashrc may explicitly include another file, ad
nauseum).
> Recent ==>
Recent isn't a directory. It's either a file or a location in GConf,
I'm not sure which.
> SendTo ==>
Has no Linux equivalent that I'm aware of, though
~/.gnome2/nautilus-scripts might work.
> StartMenu ==>
The Gnome menu layout is based on applying rules to .desktop files found
in various directories. It's not a single directory.
> MyMusic ==>
A directory for storing music hasn't been agreed upon at
freedesktop.org. This may happen in the future, though arguably the
user's home directory should be returned for now.
> DesktopDirectory ==> /home/kewhite/Desktop
> MyComputer ==>
For awhile, Gnome didn't have a My Computer equivalent. Now it does,
and it's a virtual directory.
> Templates ==>
This was added to Nautilus 2.4, IIRC, and it's ~/Templates. This may
change, though.
> ApplicationData ==> /home/kewhite/.config
> LocalApplicationData ==> /home/kewhite/.local/share
> InternetCache ==>
This is dependent upon the browser, and for Gecko-based browsers, this
will have a random string in the directory name (for security
purposes). For example, ~/.mozilla/username/XXXXXXXX.slt/Cache.
> Cookies ==>
> History ==>
Also dependent on the browser. See above.
> CommonApplicationData ==> /usr/share
> System ==>
This is C:\Windows\System32, IIRC. I suppose /usr/lib/, /usr/local/lib,
etc., would qualify, but as with Programs, only a single string can be
returned from Environment.GetFolderPath().
> ProgramFiles ==>
Ditto.
> MyPictures ==>
No common equivalent exists, though Gnome 2.10 might tackle this.
> CommonProgramFiles ==>
On Windows, C:\Program Files\Common, IIRC. I have no idea what this
would be for Unix, though /lib, /usr/lib, etc., might work (returning us
to the "Environment.GetFolderPath() can only return one string" issue).
- Jon