File tree Expand file tree Collapse file tree 3 files changed +2
-85
lines changed
Expand file tree Collapse file tree 3 files changed +2
-85
lines changed Original file line number Diff line number Diff line change @@ -761,7 +761,7 @@ def system_dir # :nodoc:
761761 # The standard directory containing system wide rake files.
762762 if Win32 . windows?
763763 def standard_system_dir #:nodoc:
764- Win32 . win32_system_dir
764+ File . join ( Dir . home , "Rake" )
765765 end
766766 else
767767 def standard_system_dir #:nodoc:
Original file line number Diff line number Diff line change @@ -6,46 +6,12 @@ module Rake
66 # will be placed here to collect that knowledge in one spot.
77 module Win32 # :nodoc: all
88
9- # Error indicating a problem in locating the home directory on a
10- # Win32 system.
11- class Win32HomeError < RuntimeError
12- end
13-
149 class << self
1510 # True if running on a windows system.
1611 def windows?
1712 RbConfig ::CONFIG [ "host_os" ] =~ %r!(msdos|mswin|djgpp|mingw|[Ww]indows)!
1813 end
19-
20- # The standard directory containing system wide rake files on
21- # Win 32 systems. Try the following environment variables (in
22- # order):
23- #
24- # * HOME
25- # * HOMEDRIVE + HOMEPATH
26- # * APPDATA
27- # * USERPROFILE
28- #
29- # If the above are not defined, the return nil.
30- def win32_system_dir #:nodoc:
31- win32_shared_path = ENV [ "HOME" ]
32- if win32_shared_path . nil? && ENV [ "HOMEDRIVE" ] && ENV [ "HOMEPATH" ]
33- win32_shared_path = ENV [ "HOMEDRIVE" ] + ENV [ "HOMEPATH" ]
34- end
35-
36- win32_shared_path ||= ENV [ "APPDATA" ]
37- win32_shared_path ||= ENV [ "USERPROFILE" ]
38- raise Win32HomeError ,
39- "Unable to determine home path environment variable." if
40- win32_shared_path . nil? or win32_shared_path . empty?
41- normalize ( File . join ( win32_shared_path , "Rake" ) )
42- end
43-
44- # Normalize a win32 path so that the slashes are all forward slashes.
45- def normalize ( path )
46- path . gsub ( /\\ / , "/" )
47- end
48-
4914 end
15+
5016 end
5117end
Original file line number Diff line number Diff line change 33
44class TestRakeWin32 < Rake ::TestCase # :nodoc:
55
6- Win32 = Rake ::Win32 # :nodoc:
7-
8- def test_win32_system_dir_uses_home_if_defined
9- ENV [ "HOME" ] = 'C:\\HP'
10-
11- assert_equal "C:/HP/Rake" , Win32 . win32_system_dir
12- end
13-
14- def test_win32_system_dir_uses_homedrive_homepath_when_no_home_defined
15- ENV [ "HOME" ] = nil
16- ENV [ "HOMEDRIVE" ] = "C:"
17- ENV [ "HOMEPATH" ] = '\\HP'
18-
19- assert_equal "C:/HP/Rake" , Win32 . win32_system_dir
20- end
21-
22- def test_win32_system_dir_uses_appdata_when_no_home_or_home_combo
23- ENV [ "APPDATA" ] = "C:\\ Documents and Settings\\ HP\\ Application Data"
24- ENV [ "HOME" ] = nil
25- ENV [ "HOMEDRIVE" ] = nil
26- ENV [ "HOMEPATH" ] = nil
27-
28- assert_equal "C:/Documents and Settings/HP/Application Data/Rake" ,
29- Win32 . win32_system_dir
30- end
31-
32- def test_win32_system_dir_fallback_to_userprofile_otherwise
33- ENV [ "HOME" ] = nil
34- ENV [ "HOMEDRIVE" ] = nil
35- ENV [ "HOMEPATH" ] = nil
36- ENV [ "APPDATA" ] = nil
37- ENV [ "USERPROFILE" ] = "C:\\ Documents and Settings\\ HP"
38-
39- assert_equal "C:/Documents and Settings/HP/Rake" , Win32 . win32_system_dir
40- end
41-
42- def test_win32_system_dir_nil_of_no_env_vars
43- ENV [ "APPDATA" ] = nil
44- ENV [ "HOME" ] = nil
45- ENV [ "HOMEDRIVE" ] = nil
46- ENV [ "HOMEPATH" ] = nil
47- ENV [ "RAKE_SYSTEM" ] = nil
48- ENV [ "USERPROFILE" ] = nil
49-
50- assert_raises ( Rake ::Win32 ::Win32HomeError ) do
51- Win32 . win32_system_dir
52- end
53- end
54-
556 def test_win32_backtrace_with_different_case
567 ex = nil
578 begin
You can’t perform that action at this time.
0 commit comments