Next in Review Queue: The New std.path

torhu no at spam.invalid
Mon Jul 18 11:29:08 PDT 2011


On 18.07.2011 15:55, Steven Schveighoffer wrote:
...
> Certainly not having that function on Windows will encourage them to
> choose a wrong choice then, no?  I mean if they want to find a "home
> directory" and phobos doesn't support that, then they google online, find
> something like %userprofile%, use it, and maybe file a bug against phobos
> for good measure :)
>
> So there is no right answer, we should at least come up with *an* answer.
> In the Windows world of de-facto standards, we're bound to start a trend ;)
>
> What about this?
>
> ~/Application Data =>  %APPDATA%
> ~/Local Settings/Application Data =>  %LOCALAPPDATA% or %USERPROFILE%\Local
> Settings\Application Data
> etc.
> Last resort:
> ~ =>  %USERPROFILE%
>
> In other words, expand more than just the tilde.

Wouldn't that tend to cause the same issue? They use tilde on Linux, 
then get %userprofile% because they didn't change it when they port to 
Windows.  If people know that they want %appdata%, they could just use that.

> My thoughts are, if we try and take a stab at making something
> intelligently decide where to store files, people will appreciate it more
> than having to search the web for a right answer to something that doesn't
> have one.

That could be done, here's an example I'm familiar with:
http://www.allegro.cc/manual/5/al_get_standard_path

This is designed to work across all the major platforms.  Some paths 
will be the same on some platforms.  ALLEGRO_USER_DOCUMENTS_PATH, 
ALLEGRO_USER_DATA_PATH, and ALLEGRO_USER_SETTINGS_PATH are probably the 
most relevant ones for this discussion.


More information about the Digitalmars-d mailing list