Next in Review Queue: The New std.path

Nick Sabalausky a at a.a
Fri Jul 15 13:15:23 PDT 2011


"Steven Schveighoffer" <schveiguy at yahoo.com> wrote in message 
news:op.vyoeirtveav7ka at localhost.localdomain...
> On Fri, 15 Jul 2011 15:21:49 -0400, Nick Sabalausky <a at a.a> wrote:
>
>>
>> Actually, if Windows did have one single equivalent to "/home/{user}", 
>> then
>> I think it would be absolutely fantastic to make tilde mean "home 
>> directory"
>> on Windows. But as things are, that's a moot point, of course.
>
> The typical thing is to use the environment variable USERPROFILE, but 
> that's an odd dependency for a string processing library.  Windows also 
> doesn't keep the same notion of home directory as Unix does.  You can read 
> more about it here:  http://en.wikipedia.org/wiki/Environment_variable
>
> If that's the only function that uses environment variables, and you can't 
> have the function without it, it might be worth having it.  However, we 
> must think about how that affects things like purity.
>

No, like I've said, all the possible choices are frequently wrong, and that 
includes USERPROFILE.

If you're selecting a default directory for the user to save/load a word 
processing document, then USERPROFILE is wrong (should be the user's My 
Documents - or the last used directory, whatever).

If you're storing per-user application-settings/internal-application-data, 
then USERPROFILE is wrong. It should be APPDATA if it's roaming data (should 
remain with the user on different computers). Or if it's machine-specific 
(non-roaming) data, then it belongs in whatever the env variable for 
"%APPDATA%\Local Settings\Application Data" is.

So expanding tilde to USERPROFILE will just encourage people to do the wrong 
thing.





More information about the Digitalmars-d mailing list