Method: Zip::ZipFile#initialize

Defined in:
lib/pik/contrib/zip/zip.rb

#initialize(fileName, create = nil) ⇒ ZipFile

Opens a zip archive. Pass true as the second parameter to create a new archive if it doesn’t exist already.



1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
# File 'lib/pik/contrib/zip/zip.rb', line 1355

def initialize(fileName, create = nil)
  super()
  @name = fileName
  @comment = ""
  if (File.exists?(fileName))
  File.open(name, "rb") { |f| read_from_stream(f) }
  elsif (create)
  @entrySet = ZipEntrySet.new
  else
  raise ZipError, "File #{fileName} not found"
  end
  @create = create
  @storedEntries = @entrySet.dup

  @restore_ownership = false
  @restore_permissions = false
  @restore_times = true
end