Skip to content

Commit

Permalink
Merge pull request #170 from sgtcoolguy/issue-169
Browse files Browse the repository at this point in the history
Fix #169 - Files with very long paths fail to extract on Windows
  • Loading branch information
tas50 authored Dec 6, 2016
2 parents e790c0d + 7552305 commit 866a595
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libraries/sevenzip_command_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ def sevenzip_command
return sevenzip_command_builder(resource.path, 'x')
end

tmpdir = make_temp_directory
tmpdir = make_temp_directory.tr('/', '\\')
cmd = sevenzip_command_builder(tmpdir, 'e')

cmd += ' && '
currdir = tmpdir.tr('/', '\\')
currdir = tmpdir

1.upto(resource.strip_components).each do |count|
cmd += "for /f %#{count} in ('dir /ad /b \"#{currdir}\"') do "
currdir += "\\%#{count}"
end

cmd += "#{ENV.fetch('SystemRoot')}\\System32\\xcopy \"#{currdir}\" \"#{resource.home_dir}\" /s /e"
cmd += "(#{ENV.fetch('SystemRoot')}\\System32\\robocopy \"#{currdir}\" \"#{resource.home_dir}\" /s /e) ^& IF %ERRORLEVEL% LEQ 3 cmd /c exit 0"
end

def sevenzip_binary
Expand Down

0 comments on commit 866a595

Please sign in to comment.