mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/tmpdir.rb (@@systmpdir): File.expand_path also joins paths.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
22f1a984f1
commit
a285f8565d
2 changed files with 7 additions and 4 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Thu Feb 19 15:17:00 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/tmpdir.rb (@@systmpdir): File.expand_path also joins paths.
|
||||||
|
|
||||||
Thu Feb 19 15:14:25 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Thu Feb 19 15:14:25 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* ext/etc/etc.c (etc_each_group): defines only when Etc::Group is
|
* ext/etc/etc.c (etc_each_group): defines only when Etc::Group is
|
||||||
|
|
|
@ -18,17 +18,16 @@ class Dir
|
||||||
begin
|
begin
|
||||||
getdir = Win32API.new('shell32', 'SHGetFolderPath', 'LLLLP', 'L')
|
getdir = Win32API.new('shell32', 'SHGetFolderPath', 'LLLLP', 'L')
|
||||||
raise RuntimeError if getdir.call(0, CSIDL_LOCAL_APPDATA, 0, 0, windir) != 0
|
raise RuntimeError if getdir.call(0, CSIDL_LOCAL_APPDATA, 0, 0, windir) != 0
|
||||||
windir = File.expand_path(windir.rstrip)
|
windir.rstrip!
|
||||||
rescue RuntimeError
|
rescue RuntimeError
|
||||||
begin
|
begin
|
||||||
getdir = Win32API.new('kernel32', 'GetSystemWindowsDirectory', 'PL', 'L')
|
getdir = Win32API.new('kernel32', 'GetSystemWindowsDirectory', 'PL', 'L')
|
||||||
rescue RuntimeError
|
rescue RuntimeError
|
||||||
getdir = Win32API.new('kernel32', 'GetWindowsDirectory', 'PL', 'L')
|
getdir = Win32API.new('kernel32', 'GetWindowsDirectory', 'PL', 'L')
|
||||||
end
|
end
|
||||||
len = getdir.call(windir, windir.size)
|
windir[getdir.call(windir, windir.size)..-1] = ""
|
||||||
windir = File.expand_path(windir[0, len])
|
|
||||||
end
|
end
|
||||||
temp = File.join(windir.untaint, 'temp')
|
temp = File.expand_path('temp', windir.untaint)
|
||||||
@@systmpdir = temp if File.directory?(temp) and File.writable?(temp)
|
@@systmpdir = temp if File.directory?(temp) and File.writable?(temp)
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue