You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Extract places files where ever ruby was started #12
Currently if you use #extract, the extracted files go to wherever the ruby process was started. This is an issue if the script is part of a crontab or such. It would be nice if either the method assumed to extract to the same directory the archive is in or if there was an option to set a directory to extract to. Thanks for the gem by the way.
a=Archive.new(@file)# My archives are a compressed folderfolder=a.each{ |e| breakFile.dirname(e.to_s)}# Extract to folder of archivebase=File.join(Dir.pwd,File.dirname(@file))FileUtils.mkdir_p(File.join(base,folder))a.eachdo |entry,data|
# Go through each entry and datapath=File.join(base,entry.to_s)ifpath.end_with?('/')# Create Directory if the entry is a directoryFileUtils.mkdir_p(path)else# Or write file to disk if the entry is a fileFile.open(path,'w+'){ |f| f.write(data)}endend
Activity
manuelfitz commentedon Oct 27, 2015
An alternative for people using libarchive-ruby