On Tue, Aug 23, 2011 at 12:46 PM, Ken Barber <k...@puppetlabs.com> wrote:

> Thanks Josh.
>
> > The ProgramData environment variable is not supported on 2003. The
> > equivalent directory on 2003 (and other legacy systems)
> > is %ALLUSERSPROFILE%\Application Data.[1]
>
> Gah! (/me goes off to download Windows 2003 ...).
>
> So in 2008R2 ALLUSERSPROFILE points at C:\ProgramData ... so if you
> use the suffix Application Data there its going to be in 2008R2:
>
> C:\ProgramData\Application Data
>
> Which is wrong. So I'll need to be careful about this depending on the
> different versions of windows ...


If PROGRAMDATA is defined, I would use that value.
Otherwise, if ALLUSERSPROFILE is defined (and it should be), I would use
%ALLUSERSPROFILE%\Application Data

The other alternative is to call the SHGetFolderPath Win32 API directly,
similar to what win32-dir does[1]

Something else to keep in mind is that puppet only uses Dir::COMMON_APPDATA
when running as "root" on Windows. When running as a non-privileged user it
stores configuration data in the user's ~/.puppet directory.

Josh

[1] https://github.com/djberg96/win32-dir/blob/master/lib/win32/dir.rb

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to puppet-dev@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to