Environment variable for application storage under OSX ?

Maeriden via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 16 18:59:14 PDT 2015


On Thursday, 16 July 2015 at 21:12:05 UTC, anonymous wrote:
> I have the following code, working under Win and Linux:
>
> ---
> import std.process: environment;
>
> immutable string p;
>
> static this() {
>     version(Win32) p = environment.get("APPDATA");
>     version(linux) p = "/home/" ~ environment.get("USER");
>     version(OSX) p = "?";
> }
> ---
>
> what would be the OSX equivalent (to get the path where the 
> applications data are commonmly stored)?

I'd like to point out that the xdg specification specifies 
subdirectories of the home directory to store application data on 
linux.
I hate when applications litter my home with configuration folders


More information about the Digitalmars-d-learn mailing list