Skip to content

Commit 7d6429a

Browse files
author
klab-sytems
committed
Resolve 7zip command checks for proper PS fallback
1 parent a072ac0 commit 7d6429a

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

lib/puppet_x/bodeco/archive.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ def extract(path = root_dir, opts = {})
6161
private
6262

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

0 commit comments

Comments
 (0)