rubyzip creates some temporary files during its work. While all of them are deleted after my ruby program is finished, they still exist after I finish working with the ZIP file.
Here's a sample program (ziptest.rb) to demonstrate the problem:
require 'rubygems'
require 'zip/zipfilesystem'
puts "1: " + Dir['*'].join(",")
Zip::ZipFile.open("test.zip", Zip::ZipFile::CREATE) do |zipfile|
zipfile.get_output_stream("file1") { |f| f.write("content1") }
puts "2: " + Dir['*'].join(",")
zipfile.get_output_stream("file2") { |f| f.write("content2") }
puts "3: " + Dir['*'].join(",")
end
puts "4: " + Dir['*'].join(",")
Here's the execution output:
sh-3.00$ ls -l
total 8
-rw-rw-r-- 1 dubek dubek 382 Apr 17 17:05 ziptest.rb
sh-3.00$ ruby ziptest.rb
1: ziptest.rb
2: ziptest.rb,file1.19397.0
3: file2.19397.0,ziptest.rb,file1.19397.0
4: file2.19397.0,ziptest.rb,test.zip,file1.19397.0
sh-3.00$ ls -l
total 16
-rw------- 1 dubek dubek 214 Apr 17 17:06 test.zip
-rw-rw-r-- 1 dubek dubek 382 Apr 17 17:05 ziptest.rb
sh-3.00$
As one can see in stage "4:" there are two temporary files on the disk (file1.19397.0 and file2.19397.1), but the ZIP file is already finished and closed.
Thanks in advance,
dubek.
Anonymous
Logged In: YES
user_id=1903798
Originator: NO
Yeah this is a particularly problematic when rubydic is used within the context of a rails app. Would be great to see temp files removed when zip file is closed.
Logged In: YES
user_id=1903798
Originator: NO
'rubydic' should have been 'rubyzip'