Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

merge revision(s) 17643:

	* lib/tmpdir.rb (@@systmpdir): prior LOCAL_APPDATA if possible, and
	  should be clean.  based on a patch from arton <artonx AT
	  yahoo.co.jp> at [ruby-dev:35269]


git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_7@17801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
commit 08ea382e837fa65a51fb576a824bbe63fcad87a5 1 parent bad6a4a
@shyouhei shyouhei authored
Showing with 20 additions and 7 deletions.
  1. +6 −0 ChangeLog
  2. +13 −6 lib/tmpdir.rb
  3. +1 −1  version.h
View
6 ChangeLog
@@ -1,3 +1,9 @@
+Wed Jul 2 18:22:52 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/tmpdir.rb (@@systmpdir): prior LOCAL_APPDATA if possible, and
+ should be clean. based on a patch from arton <artonx AT
+ yahoo.co.jp> at [ruby-dev:35269]
+
Wed Jul 2 18:16:19 2008 Masaki Suketa <masaki.suketa@nifty.ne.jp>
* ext/win32ole/win32ole.c (date2time_str): fix the overflow in
View
19 lib/tmpdir.rb
@@ -12,16 +12,23 @@ class Dir
begin
require 'Win32API'
+ CSIDL_LOCAL_APPDATA = 0x001c
max_pathlen = 260
windir = ' '*(max_pathlen+1)
begin
- getdir = Win32API.new('kernel32', 'GetSystemWindowsDirectory', 'PL', 'L')
+ 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)
rescue RuntimeError
- getdir = Win32API.new('kernel32', 'GetWindowsDirectory', 'PL', 'L')
+ 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])
end
- len = getdir.call(windir, windir.size)
- windir = File.expand_path(windir[0, len])
- temp = File.join(windir, 'temp')
+ temp = File.join(windir.untaint, 'temp')
@@systmpdir = temp if File.directory?(temp) and File.writable?(temp)
rescue LoadError
end
@@ -41,8 +48,8 @@ def Dir::tmpdir
break
end
end
+ File.expand_path(tmp)
end
- File.expand_path(tmp)
end
# Dir.mktmpdir creates a temporary directory.
View
2  version.h
@@ -2,7 +2,7 @@
#define RUBY_RELEASE_DATE "2008-07-02"
#define RUBY_VERSION_CODE 187
#define RUBY_RELEASE_CODE 20080702
-#define RUBY_PATCHLEVEL 41
+#define RUBY_PATCHLEVEL 42
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 8
Please sign in to comment.
Something went wrong with that request. Please try again.