From 5fc42a3ce9831c429bd9ca0606508db88426a0e4 Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Sun, 19 Jun 2022 21:54:59 -0500 Subject: [PATCH] Fixed win32 auto importer game name FIXME, fix games install_path/exe_path stored with backwards slashes- \\ instead of / --- lib/application_manager.rb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/application_manager.rb b/lib/application_manager.rb index 96552b5..b37bb97 100644 --- a/lib/application_manager.rb +++ b/lib/application_manager.rb @@ -229,17 +229,19 @@ class W3DHub Store.applications.games.each do |game| game.channels.each do |channel| if game.id == "ren" && channel.id == "release" - auto_import_win32_registry(game.id, channel.id, 'SOFTWARE\Westwood\Renegade') + auto_import_win32_registry(game, channel.id, 'SOFTWARE\Westwood\Renegade') else - auto_import_win32_registry(game.id, channel.id) + auto_import_win32_registry(game, channel.id) end end end end - def auto_import_win32_registry(app_id, channel_id, registry_path = nil) + def auto_import_win32_registry(game, channel_id, registry_path = nil) return unless W3DHub.windows? + app_id = game.id + logger.info(LOG_TAG) { "Importing: #{app_id}-#{channel_id}" } require "win32/registry" @@ -252,14 +254,15 @@ class W3DHub begin reg_constant.open(registry_path, reg_type) do |reg| if (install_path = reg["InstallDir"]) + install_path.gsub!("\\", "/") + exe_path = app_id == "ecw" ? "#{install_path}/game750.exe" : "#{install_path}/game.exe" if File.exist?(exe_path) - install_path.gsub!("\\", "/") installed_version = reg["InstalledVersion"] unless app_id == "ren" application_data = { - name: task.application.name, # FIXME! + name: game.name, install_directory: install_path, installed_version: app_id == "ren" ? "1.0.0.0" : installed_version, install_path: exe_path,