mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00

* variable.c (rb_const_get_at): allow "const_missing" hook. * variable.c (rb_const_get_0): ditto. * eval.c (method_missing): rename from rb_undefined to clarify. * eval.c (ruby_finalize_0): update exit status if any of END proc raises SystemExit. [ruby-core:01256] * eval.c (rb_exec_end_proc): reduce rb_protect(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
26 lines
520 B
Ruby
26 lines
520 B
Ruby
#
|
|
# tmpdir - retrieve temporary directory path
|
|
#
|
|
# $Id$
|
|
#
|
|
|
|
class Dir
|
|
begin
|
|
require "Win32API"
|
|
max_pathlen = 260
|
|
t_path = ' '*(max_pathlen+1)
|
|
t_path = t_path[0, Win32API.new('kernel32', 'GetTempPath', 'LP', 'L').call(t_path.size, t_path)]
|
|
t_path.untaint
|
|
TMPDIR = File.expand_path(t_path)
|
|
rescue LoadError
|
|
if $SAFE > 0
|
|
TMPDIR = '/tmp'
|
|
else
|
|
TMPDIR = File.expand_path(ENV['TMPDIR']||ENV['TMP']||ENV['TEMP']||'/tmp')
|
|
end
|
|
end
|
|
end
|
|
|
|
if __FILE__ == $0
|
|
puts Dir::TMPDIR
|
|
end
|