From 19eb1a66e978e733fb260f44aeb7aee255778730 Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Fri, 19 Nov 2021 20:27:36 -0600 Subject: [PATCH] Fixes for linux (Interim Apex not installs and RUNS!) --- lib/application_manager.rb | 14 ++++++++++++-- lib/application_manager/task.rb | 14 ++++++++------ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/lib/application_manager.rb b/lib/application_manager.rb index 27d1d93..82902bf 100644 --- a/lib/application_manager.rb +++ b/lib/application_manager.rb @@ -46,7 +46,7 @@ class W3DHub exe = "#{app_data[:install_directory]}/#{config_exe}" if File.exist?(exe) - Process.spawn("\"#{exe}\"") + Process.spawn("#{wine_command(app_id, channel)}\"#{exe}\"") end end end @@ -86,9 +86,19 @@ class W3DHub end end + def wine_command(app_id, channel) + return "" if W3DHub.windows? + + if window.settings[:wine_prefix] + "WINEPREFIX=\"#{window.settings[:wine_prefix]}\" \"#{window.settings[:wine_command]}\" " + else + "#{window.settings[:wine_command]} " + end + end + def run(app_id, channel, *args) if (app_data = installed?(app_id, channel)) - Process.spawn("\"#{app_data[:install_path]}\"", *args) + Process.spawn("#{wine_command(app_id, channel)}\"#{app_data[:install_path]}\"", *args) end end diff --git a/lib/application_manager/task.rb b/lib/application_manager/task.rb index f3bfd00..560c82d 100644 --- a/lib/application_manager/task.rb +++ b/lib/application_manager/task.rb @@ -98,12 +98,12 @@ class W3DHub # Quick checks before network and computational work starts def fail_fast # tar present? - tar_present = system("tar --help") - fail!("FAIL FAST: `tar --help` command failed, tar is not installed. Will be unable to unpack packages.") unless 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 if W3DHub.unix? wine_present = system("which #{window.settings[:wine_command]}") - fail!("FAIL FAST: `which wine` command failed, wine is not installed. Will be unable to create prefixes or launch games.") unless wine_prefix + fail!("FAIL FAST: `which #{window.settings[:wine_command]}` command failed, wine is not installed. Will be unable to create prefixes or launch games.") unless wine_present end end @@ -257,17 +257,19 @@ class W3DHub def unpack_packages(packages) path = Cache.install_path(@application, @channel) puts "Unpacking packages in '#{path}'..." - Cache.create_directories(path) + Cache.create_directories(path, true) packages.each do |package| puts " #{package.name}:#{package.version}" package_path = Cache.package_path(package.category, package.subcategory, "#{package.name}.zip", package.version) - puts " Running tar command: #{"tar -xf #{package_path} -C #{path}"}" - status = system("tar -xf #{package_path} -C #{path}") + puts " Running bsdtar command: #{"bsdtar -xf #{package_path} -C #{path}"}" + status = system("bsdtar -xf #{package_path} -C #{path}") if status else puts "COMMAND FAILED!" + fail!("Failed to unpack #{package.name}") + break end end end