in reply to (OT) cross-platform $HOME

On Windows, you could look for $ENV{USERPROFILE}, and store the info in "$ENV{USERPROFILE}\\Application Data\\myapp" - that is a convention many MS apps follow.

The "Application Data" folder is usually hidden, so it already captures the meaning of the leading ".".

Many 3'rd party apps in Windows store data either in the App directory, or a sub-directory. Small quantities of data and config info is stored in the Registry, but you probably don't want to touch that if you are writing a cross-platform app. In your case I'd recommend the "Application Data" directory above.

"Experience is a wonderful thing. It enables you to recognize a mistake when you make it again."

Replies are listed 'Best First'.
Re: Re: (OT) cross-platform $HOME
by BrowserUk (Pope) on Feb 23, 2004 at 05:07 UTC

    On XP, you can short-circuit the route to the Application Data directory using $ENV{ APPDATA }, but I'm not sure when (which version) this became available. It wasn't there on NT4, so I think your suggestion is probably better if backwards compatiblity is a concern.

    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    Timing (and a little luck) are everything!

      ++BrowserUK. This approach is also better because it supports locales. The application data directory is not always called "Application Data" (e.g. in the German locale it's called "Anwendungsdateien").