Method: Zip::ZipEntry#gather_fileinfo_from_srcpath

Defined in:
lib/ruby_archive/handlers/rubyzip/zip/zip.rb

#gather_fileinfo_from_srcpath(srcPath) ⇒ Object

:nodoc:



797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
# File 'lib/ruby_archive/handlers/rubyzip/zip/zip.rb', line 797

def gather_fileinfo_from_srcpath(srcPath) # :nodoc:
  stat = file_stat(srcPath)
  case stat.ftype
  when 'file'
    if name_is_directory?
      raise ArgumentError,
 "entry name '#{newEntry}' indicates directory entry, but "+
 "'#{srcPath}' is not a directory"
    end
    @ftype = :file
  when 'directory'
    if ! name_is_directory?
      @name += "/"
    end
    @ftype = :directory
  when 'link'
    if name_is_directory?
      raise ArgumentError,
 "entry name '#{newEntry}' indicates directory entry, but "+
 "'#{srcPath}' is not a directory"
    end
    @ftype = :symlink
  else
  	raise RuntimeError, "unknown file type: #{srcPath.inspect} #{stat.inspect}"
  end

  @filepath = srcPath
  get_extra_attributes_from_path(@filepath)
end