lib/dearchiver/processor.rb
# Extracts the content of the compressed file to the specified directory.
# Warning: it will overwrite the existing files without asking.
#
# @param [String] destination the directory with full path to extracts the files to.
#
# @return [Array] an array of strings with the extracted file list.
#
Extracts the content of the compressed file to the specified directory.
Warning: it will overwrite the existing files without asking.
Extracts the content of the compressed file to the specified directory . Warning : it will overwrite the existing files without asking .
def extract_to(destination)
      raise ArgumentError, "Processor: destination is required!" if destination.nil? or destination.empty?
      raise RuntimeError, "destination directory is not valid" unless Dir.exists?(destination)
      @list_of_files = []
      result = execute_command(archive_options[@archive_type][:decompress].gsub("<filename>", filename).gsub("<extractdir>", destination))
      result.scan(archive_options[@archive_type][:file_list_regex]).each do |slice|
        @list_of_files << slice.first.gsub("\b","").strip
      end
      @list_of_files
    end
def extract_to ( destination ) raise ArgumentError , "Processor: destination is required!" if destination . nil? or destination . empty? raise RuntimeError , "destination directory is not valid" unless Dir . exists? ( destination ) @list_of_files = [ ] result = execute_command ( archive_options [ @archive_type ] [ :decompress ] . gsub ( "<filename>" , filename ) . gsub ( "<extractdir>" , destination ) ) result . scan ( archive_options [ @archive_type ] [ :file_list_regex ] ) . each do | slice | @list_of_files << slice . first . gsub ( "\b" , "" ) . strip end @list_of_files end
Extracts the content of the compressed file to the specified directory.
Extracts the content of the compressed file to the specified directory .
# The gsub("\b","") is a hack to make the list file for unrar work.
an array of strings with the extracted file list.
an array of strings with the extracted file list .
Array
destination
<not_specific>
<not_specific>
destination the directory with full path to extracts the files to.
destination the directory with full path to extracts the files to .