[前][次][番号順一覧][スレッド一覧]

ruby-changes:6285

From: shyouhei <ko1@a...>
Date: Wed, 2 Jul 2008 18:22:41 +0900 (JST)
Subject: [ruby-changes:6285] Ruby:r17799 (ruby_1_8_6): merge revision(s) 17643:

shyouhei	2008-07-02 18:22:26 +0900 (Wed, 02 Jul 2008)

  New Revision: 17799

  Modified files:
    branches/ruby_1_8_6/ChangeLog
    branches/ruby_1_8_6/lib/tmpdir.rb
    branches/ruby_1_8_6/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=17799

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_6/ChangeLog?r1=17799&r2=17798&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_6/version.h?r1=17799&r2=17798&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_6/lib/tmpdir.rb?r1=17799&r2=17798&diff_format=u

Index: ruby_1_8_6/ChangeLog
===================================================================
--- ruby_1_8_6/ChangeLog	(revision 17798)
+++ ruby_1_8_6/ChangeLog	(revision 17799)
@@ -1,3 +1,9 @@
+Wed Jul  2 18:19:45 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:13:30 2008  Masaki Suketa  <masaki.suketa@n...>
 
 	* ext/win32ole/win32ole.c (date2time_str): fix the overflow in
Index: ruby_1_8_6/version.h
===================================================================
--- ruby_1_8_6/version.h	(revision 17798)
+++ ruby_1_8_6/version.h	(revision 17799)
@@ -2,7 +2,7 @@
 #define RUBY_RELEASE_DATE "2008-07-02"
 #define RUBY_VERSION_CODE 186
 #define RUBY_RELEASE_CODE 20080702
-#define RUBY_PATCHLEVEL 259
+#define RUBY_PATCHLEVEL 260
 
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 8
Index: ruby_1_8_6/lib/tmpdir.rb
===================================================================
--- ruby_1_8_6/lib/tmpdir.rb	(revision 17798)
+++ ruby_1_8_6/lib/tmpdir.rb	(revision 17799)
@@ -10,16 +10,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
@@ -39,7 +46,7 @@
 	  break
 	end
       end
+      File.expand_path(tmp)
     end
-    File.expand_path(tmp)
   end
 end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]