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

ruby-changes:10866

From: nobu <ko1@a...>
Date: Thu, 19 Feb 2009 15:17:12 +0900 (JST)
Subject: [ruby-changes:10866] Ruby:r22439 (trunk): * lib/tmpdir.rb (@@systmpdir): File.expand_path also joins paths.

nobu	2009-02-19 15:17:01 +0900 (Thu, 19 Feb 2009)

  New Revision: 22439

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=22439

  Log:
    * lib/tmpdir.rb (@@systmpdir): File.expand_path also joins paths.

  Modified files:
    trunk/ChangeLog
    trunk/lib/tmpdir.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 22438)
+++ ChangeLog	(revision 22439)
@@ -1,3 +1,7 @@
+Thu Feb 19 15:17:00 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* lib/tmpdir.rb (@@systmpdir): File.expand_path also joins paths.
+
 Thu Feb 19 15:14:25 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* ext/etc/etc.c (etc_each_group): defines only when Etc::Group is
Index: lib/tmpdir.rb
===================================================================
--- lib/tmpdir.rb	(revision 22438)
+++ lib/tmpdir.rb	(revision 22439)
@@ -18,17 +18,16 @@
     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

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

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