Skip to content

Commit

Permalink
merge revision(s) 17643:
Browse files Browse the repository at this point in the history
	* 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_6@17799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
shyouhei committed Jul 2, 2008
1 parent c469ec5 commit d70edc3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Wed Jul 2 18:19:45 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:13:30 2008 Masaki Suketa <masaki.suketa@nifty.ne.jp>

* ext/win32ole/win32ole.c (date2time_str): fix the overflow in
Expand Down
19 changes: 13 additions & 6 deletions lib/tmpdir.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,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
Expand All @@ -39,7 +46,7 @@ def Dir::tmpdir
break
end
end
File.expand_path(tmp)
end
File.expand_path(tmp)
end
end
2 changes: 1 addition & 1 deletion version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d70edc3

Please sign in to comment.