* lib/tempfile.rb (Tempfile::initialize): got out code of
generating tmpname. [ruby-dev:23832][ruby-dev:23837] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
10b0f97ae9
commit
dbc7ba14a0
@ -1,3 +1,8 @@
|
|||||||
|
Thu Jul 8 00:05:23 2004 akira yamada <akira@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/tempfile.rb (Tempfile::initialize): got out code of
|
||||||
|
generating tmpname. [ruby-dev:23832][ruby-dev:23837]
|
||||||
|
|
||||||
Wed Jul 7 02:31:41 2004 Kouhei Sutou <kou@cozmixng.org>
|
Wed Jul 7 02:31:41 2004 Kouhei Sutou <kou@cozmixng.org>
|
||||||
|
|
||||||
* lib/rss/{rss,parser,0.9,1.0,2.0}.rb: supported RSS 0.9x/2.0
|
* lib/rss/{rss,parser,0.9,1.0,2.0}.rb: supported RSS 0.9x/2.0
|
||||||
|
@ -33,7 +33,7 @@ class Tempfile < DelegateClass(File)
|
|||||||
Thread.critical = true
|
Thread.critical = true
|
||||||
|
|
||||||
begin
|
begin
|
||||||
tmpname = sprintf('%s/%s%d.%d', tmpdir, basename, $$, n)
|
tmpname = File.join(tmpdir, make_tmpname(basename, n))
|
||||||
lock = tmpname + '.lock'
|
lock = tmpname + '.lock'
|
||||||
n += 1
|
n += 1
|
||||||
end while @@cleanlist.include?(tmpname) or
|
end while @@cleanlist.include?(tmpname) or
|
||||||
@ -66,6 +66,11 @@ class Tempfile < DelegateClass(File)
|
|||||||
Dir.rmdir(lock)
|
Dir.rmdir(lock)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def make_tmpname(basename, n)
|
||||||
|
sprintf('%s%d.%d', basename, $$, n)
|
||||||
|
end
|
||||||
|
private :make_tmpname
|
||||||
|
|
||||||
# Opens or reopens the file with mode "r+".
|
# Opens or reopens the file with mode "r+".
|
||||||
def open
|
def open
|
||||||
@tmpfile.close if @tmpfile
|
@tmpfile.close if @tmpfile
|
||||||
|
Loading…
x
Reference in New Issue
Block a user