Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #169 - Files with very long paths fail to extract on Windows #170

Merged
merged 2 commits into from
Dec 6, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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