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

Resolve 7zip command checks for proper PS fallback #523

Merged
merged 1 commit into from
Jun 26, 2024
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
10 changes: 5 additions & 5 deletions lib/puppet_x/bodeco/archive.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ def extract(path = root_dir, opts = {})
private

def win_7zip
if ENV['path'].include?('7-Zip') || system('where 7z.exe')
if system('where 7z.exe')
'7z.exe'
elsif File.directory?('C:\\Program Files\\7-Zip')
'C:\\Program Files\\7-Zip\\7z.exe'
elsif File.directory?('C:\\Program Files (x86)\\7-zip')
'C:\\Program Files (x86)\\7-Zip\\7z.exe'
elsif File.exist?('C:\Program Files\7-Zip\7z.exe')
'C:\Program Files\7-Zip\7z.exe'
elsif File.exist?('C:\Program Files (x86)\7-zip\7z.exe')
'C:\Program Files (x86)\7-Zip\7z.exe'
elsif @file_path =~ %r{.zip"$}
# Fallback to powershell for zipfiles - this works with windows
# 2012+ if your powershell/.net is too old the script will fail
Expand Down