summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-19 06:17:01 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-19 06:17:01 +0000
commit36ef64510edba7a70e561ea83168f04689008ccc (patch)
tree92653eae7bf6997ae6a1691ff5f93a755d99b666 /lib
parente276982e82549ad8ed8674ff2d2bf42f94f9008f (diff)
downloadruby-36ef64510edba7a70e561ea83168f04689008ccc.tar.gz
ruby-36ef64510edba7a70e561ea83168f04689008ccc.tar.xz
ruby-36ef64510edba7a70e561ea83168f04689008ccc.zip
* lib/tmpdir.rb (@@systmpdir): File.expand_path also joins paths.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/tmpdir.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/tmpdir.rb b/lib/tmpdir.rb
index bcd66ab42..788ddbd1e 100644
--- a/lib/tmpdir.rb
+++ b/lib/tmpdir.rb
@@ -18,17 +18,16 @@ class Dir
begin
getdir = Win32API.new('shell32', 'SHGetFolderPath', 'LLLLP', 'L')
raise RuntimeError if getdir.call(0, CSIDL_LOCAL_APPDATA, 0, 0, windir) != 0
- windir = File.expand_path(windir.rstrip)
+ windir.rstrip!
rescue RuntimeError
begin
getdir = Win32API.new('kernel32', 'GetSystemWindowsDirectory', 'PL', 'L')
rescue RuntimeError
getdir = Win32API.new('kernel32', 'GetWindowsDirectory', 'PL', 'L')
end
- len = getdir.call(windir, windir.size)
- windir = File.expand_path(windir[0, len])
+ windir[getdir.call(windir, windir.size)..-1] = ""
end
- temp = File.join(windir.untaint, 'temp')
+ temp = File.expand_path('temp', windir.untaint)
@@systmpdir = temp if File.directory?(temp) and File.writable?(temp)
rescue LoadError
end