Fixed Windows silliness

This commit is contained in:
2021-11-19 20:46:54 -06:00
parent 19eb1a66e9
commit 5801a88d95
2 changed files with 12 additions and 4 deletions

View File

@@ -98,8 +98,8 @@ class W3DHub
# Quick checks before network and computational work starts
def fail_fast
# tar present?
bsdtar_present = system("bsdtar --help")
fail!("FAIL FAST: `bsdtar --help` command failed, bsdtar is not installed. Will be unable to unpack packages.") unless bsdtar_present
bsdtar_present = system("#{W3DHub.tar_command} --help")
fail!("FAIL FAST: `#{W3DHub.tar_command} --help` command failed, #{W3DHub.tar_command} is not installed. Will be unable to unpack packages.") unless bsdtar_present
if W3DHub.unix?
wine_present = system("which #{window.settings[:wine_command]}")
@@ -263,8 +263,8 @@ class W3DHub
puts " #{package.name}:#{package.version}"
package_path = Cache.package_path(package.category, package.subcategory, "#{package.name}.zip", package.version)
puts " Running bsdtar command: #{"bsdtar -xf #{package_path} -C #{path}"}"
status = system("bsdtar -xf #{package_path} -C #{path}")
puts " Running #{W3DHub.tar_command} command: #{"#{W3DHub.tar_command} -xf #{package_path} -C #{path}"}"
status = system("#{W3DHub.tar_command} -xf #{package_path} -C #{path}")
if status
else
puts "COMMAND FAILED!"

View File

@@ -32,6 +32,14 @@ class W3DHub
linux? || mac?
end
def self.tar_command
if windows?
"tar"
else
"bsdtar"
end
end
def self.home_directory
File.expand_path("~")
end