[Rubygems-developers] Platform selection in gem install

Daniel Berger djberg96 at gmail.com
Tue Aug 14 18:50:43 EDT 2007


Alexey Verkhovsky wrote:
> On 8/14/07, Austin Ziegler <halostatue at gmail.com> wrote:
>> And the Windows solution?
> 
> There should be one, of course.
> 
> There is no good place in Windows to keep system-wide overrides, other
> than the registry.

We're just talking about a config file, right?

require 'win32/dir'

Dir::COMMON_APPDATA => "C:\\Documents and Settings\\All 
Users\\Application Data"

Many apps use Dir::APPDATA or Dir::COMMON_APPDATA for config files on MS 
Windows.

If you want to use Win32API directly, it's:

require 'Win32API'

CSIDL_COMMON_APPDATA = 0x0023
path = 0.chr * 260
SHGetFolderPath = Win32API.new('shell32','SHGetFolderPath','LLLLP','L')
SHGetFolderPath.call(0, CSIDL_COMMON_APPDATA, 0, 1, path)

puts path.strip

Regards,

Dan


More information about the Rubygems-developers mailing list