lib/utils.rb
# Initialize with the directory to zip and the location of the output archive.
Initialize with the directory to zip and the location of the output archive.
Initialize with the directory to zip and the location of the output archive .
def writeEntries(entries, path, io)
    entries.each { |e|
      zipFilePath = path == "" ? e : File.join(path, e)
      diskFilePath = File.join(@inputDir, zipFilePath)
      if File.directory?(diskFilePath)
        io.mkdir(zipFilePath)
        subdir =Dir.entries(diskFilePath); subdir.delete("."); subdir.delete("..")
        writeEntries(subdir, zipFilePath, io)
      else
        io.get_output_stream(zipFilePath) { |f| f.puts(File.open(diskFilePath, "rb").read())}
      end
    }
  end
def writeEntries ( entries , path , io ) entries . each { | e | zipFilePath = path == "" ? e : File . join ( path , e ) diskFilePath = File . join ( @inputDir , zipFilePath ) if File . directory? ( diskFilePath ) io . mkdir ( zipFilePath ) subdir = Dir . entries ( diskFilePath ) ; subdir . delete ( "." ) ; subdir . delete ( ".." ) writeEntries ( subdir , zipFilePath , io ) else io . get_output_stream ( zipFilePath ) { | f | f . puts ( File . open ( diskFilePath , "rb" ) . read ( ) ) } end } end
Initialize with the directory to zip and the location of the output archive.
Initialize with the directory to zip and the location of the output archive .
# puts "Deflating " + diskFilePath
entries
path
io