[phobos] getenv, setenv and unsetenv implemented for Windows

Lars Tandle Kyllingstad lars at kyllingen.net
Sat Aug 14 03:06:43 PDT 2010


All right, I'll have a look at std.file.  Thanks for the tip!

Also, I'd like to camelCase the functions' names (while keeping
deprecated aliases to preserve backwards compatibility for a while).
It's not crucial to me, but I think we really should try to keep a
consistent style in Phobos, and since these functions have so far been
POSIX-only and undocumented I would be surprised if it caused much
breakage.  Some suggestions:

  getEnv, setEnv, ...
  getEnvVar, setEnvVar, ...              <-- I'd prefer this
  getEnvVariable, setEnvVariable, ...    <-- ...or this
  getEnvironmentVar, setEnvironmentVar, ...
  getEnvironmentVariable, setEnvironmentVariable, ...
  etc.


-Lars



On Fri, 2010-08-13 at 12:32 -0700, Walter Bright wrote:
> 
> Lars Tandle Kyllingstad wrote:
> > Today, I noticed that the std.process functions setenv() and unsetenv()
> > only have POSIX implementations.  So I wrote Windows implementations for
> > them:
> >
> > http://github.com/kyllingstad/ltk/blob/master/ltk/system.d
> >
> > You'll also note a new Windows implementation of getEnv() and a new
> > function allEnv().
> >   
> 
> Great!
> 
> > Seeing as this is my first foray into Windows API land ever, I thought
> > I'd post it here before incorporating anything into Phobos.  Please
> > comment -- in particular I'm curious about whether it is correct to use
> > the UTF-16 functions.
> >
> >   
> 
> It is correct to use the "A" functions for Win9x, and the "W" functions 
> for all the other Windows versions. To see how to accomplish this, see 
> std\file.d and grep for useWfuncs.
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos




More information about the phobos mailing list