myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [2857] branches/datasets/app/models/pack.rb: Fixe


From: noreply
Subject: [myexperiment-hackers] [2857] branches/datasets/app/models/pack.rb: Fixed cleanup of temp files
Date: Thu, 1 Dec 2011 08:48:31 -0500 (EST)

Revision
2857
Author
fbacall
Date
2011-12-01 08:48:30 -0500 (Thu, 01 Dec 2011)

Log Message

Fixed cleanup of temp files

Modified Paths

Diff

Modified: branches/datasets/app/models/pack.rb (2856 => 2857)


--- branches/datasets/app/models/pack.rb	2011-12-01 13:31:55 UTC (rev 2856)
+++ branches/datasets/app/models/pack.rb	2011-12-01 13:48:30 UTC (rev 2857)
@@ -150,9 +150,9 @@
       if item_type != "Pack" && Authorization.is_authorized?('download', nil, item, user)
         stats[:downloaded][item_type] ||= []
         stats[:downloaded][item_type] << entry
-        zip_filenames << item_filename(item)
-        #zipfile.add_data("#{item_type.underscore.pluralize}/#{item_filename(item)}", item_data(item, user))
-        zipfile.get_output_stream("#{item_type.model_alias.underscore.pluralize}/#{item_filename(item)}") { |stream| stream.write(item_data(item, user))}
+        filename = item_filename(item)
+        zip_filenames << filename
+        zipfile.get_output_stream("#{item_type.model_alias.underscore.pluralize}/#{filename}") { |stream| stream.write(item_data(item, user))}
       elsif Authorization.is_authorized?('view', nil, item, user)
         stats[:view_only][item_type] ||= []
         stats[:view_only][item_type] << entry
@@ -181,7 +181,7 @@
    # remove any temporary files that were created while creating the zip file
    # (these are created in the same place, where the zip file is stored)
    zip_filenames.each do |temp_file|
-     FileUtils.rm Dir.glob(Pack.archive_folder + "/" + "#{temp_file}.*"), :force => true # 'force' option makes sure that exceptions are never raised
+     FileUtils.rm Dir.glob(Pack.archive_folder + "/" + "#{temp_file}*"), :force => true # 'force' option makes sure that exceptions are never raised
    end
 
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]