ruby-changes:6287
From: shyouhei <ko1@a...>
Date: Wed, 2 Jul 2008 18:23:29 +0900 (JST)
Subject: [ruby-changes:6287] Ruby:r17801 (ruby_1_8_7): merge revision(s) 17643:
shyouhei 2008-07-02 18:23:13 +0900 (Wed, 02 Jul 2008) New Revision: 17801 Modified files: branches/ruby_1_8_7/ChangeLog branches/ruby_1_8_7/lib/tmpdir.rb branches/ruby_1_8_7/version.h Log: 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] http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=17801 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_7/lib/tmpdir.rb?r1=17801&r2=17800&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_7/ChangeLog?r1=17801&r2=17800&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_7/version.h?r1=17801&r2=17800&diff_format=u Index: ruby_1_8_7/ChangeLog =================================================================== --- ruby_1_8_7/ChangeLog (revision 17800) +++ ruby_1_8_7/ChangeLog (revision 17801) @@ -1,3 +1,9 @@ +Wed Jul 2 18:22:52 2008 Nobuyoshi Nakada <nobu@r...> + + * 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@n...> * ext/win32ole/win32ole.c (date2time_str): fix the overflow in Index: ruby_1_8_7/version.h =================================================================== --- ruby_1_8_7/version.h (revision 17800) +++ ruby_1_8_7/version.h (revision 17801) @@ -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 Index: ruby_1_8_7/lib/tmpdir.rb =================================================================== --- ruby_1_8_7/lib/tmpdir.rb (revision 17800) +++ ruby_1_8_7/lib/tmpdir.rb (revision 17801) @@ -12,16 +12,23 @@ 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 @@ break end end + File.expand_path(tmp) end - File.expand_path(tmp) end # Dir.mktmpdir creates a temporary directory. -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/