Fixed win32 auto importer game name FIXME, fix games install_path/exe_path stored with backwards slashes- \\ instead of /

This commit is contained in:
2022-06-19 21:54:59 -05:00
parent 8d0c27d6fc
commit 5fc42a3ce9

View File

@@ -229,17 +229,19 @@ class W3DHub
Store.applications.games.each do |game| Store.applications.games.each do |game|
game.channels.each do |channel| game.channels.each do |channel|
if game.id == "ren" && channel.id == "release" 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 else
auto_import_win32_registry(game.id, channel.id) auto_import_win32_registry(game, channel.id)
end end
end end
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? return unless W3DHub.windows?
app_id = game.id
logger.info(LOG_TAG) { "Importing: #{app_id}-#{channel_id}" } logger.info(LOG_TAG) { "Importing: #{app_id}-#{channel_id}" }
require "win32/registry" require "win32/registry"
@@ -252,14 +254,15 @@ class W3DHub
begin begin
reg_constant.open(registry_path, reg_type) do |reg| reg_constant.open(registry_path, reg_type) do |reg|
if (install_path = reg["InstallDir"]) if (install_path = reg["InstallDir"])
install_path.gsub!("\\", "/")
exe_path = app_id == "ecw" ? "#{install_path}/game750.exe" : "#{install_path}/game.exe" exe_path = app_id == "ecw" ? "#{install_path}/game750.exe" : "#{install_path}/game.exe"
if File.exist?(exe_path) if File.exist?(exe_path)
install_path.gsub!("\\", "/")
installed_version = reg["InstalledVersion"] unless app_id == "ren" installed_version = reg["InstalledVersion"] unless app_id == "ren"
application_data = { application_data = {
name: task.application.name, # FIXME! name: game.name,
install_directory: install_path, install_directory: install_path,
installed_version: app_id == "ren" ? "1.0.0.0" : installed_version, installed_version: app_id == "ren" ? "1.0.0.0" : installed_version,
install_path: exe_path, install_path: exe_path,