summaryrefslogtreecommitdiff
path: root/misc/rubygems/patches/patch-ao
blob: 2133417db3d959bb9cdc51cb412a9a7b7b078511 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
$NetBSD: patch-ao,v 1.3 2011/03/23 14:35:05 taca Exp $

Don't hard code config file's path for gem.

--- lib/rubygems/config_file.rb.orig	2011-02-26 20:40:09.000000000 +0000
+++ lib/rubygems/config_file.rb
@@ -45,32 +45,7 @@ class Gem::ConfigFile
 
   PLATFORM_DEFAULTS = {}
 
-  system_config_path =
-    begin
-      require "etc"
-      Etc.sysconfdir
-    rescue LoadError, NoMethodError
-      begin
-        # TODO: remove after we drop 1.8.7 and 1.9.1
-        require 'Win32API'
-
-        CSIDL_COMMON_APPDATA = 0x0023
-        path = 0.chr * 260
-        if RUBY_VERSION > '1.9' then
-          SHGetFolderPath = Win32API.new 'shell32', 'SHGetFolderPath', 'PLPLP',
-          'L', :stdcall
-          SHGetFolderPath.call nil, CSIDL_COMMON_APPDATA, nil, 1, path
-        else
-          SHGetFolderPath = Win32API.new 'shell32', 'SHGetFolderPath', 'LLLLP',
-          'L'
-          SHGetFolderPath.call 0, CSIDL_COMMON_APPDATA, 0, 1, path
-        end
-
-        path.strip
-      rescue LoadError
-        "/etc"
-      end
-    end
+  system_config_path = '@PKG_SYSCONFDIR@'
 
   SYSTEM_WIDE_CONFIG_FILE = File.join system_config_path, 'gemrc'