Content store: Ignore '_game' in game names in ID generation (#8270)
authorrubenwardy <rw@rubenwardy.com>
Fri, 22 Feb 2019 03:19:52 +0000 (03:19 +0000)
committerParamat <paramat@users.noreply.github.com>
Fri, 22 Feb 2019 03:19:52 +0000 (03:19 +0000)
Fixes 'install' button continuing to be displayed after installing a game whose
name ends with '_game'.

builtin/mainmenu/dlg_contentstore.lua

index a9a9363dce433dac5d0796ea0bbb3fa97794c90f..384bee36c330bba7bfae3b8abbfef28f45e23c0c 100644 (file)
@@ -297,7 +297,12 @@ function store.load()
                                package.author .. "/" .. package.name ..
                                "/releases/" .. package.release .. "/download/"
 
-                       package.id = package.author .. "/" .. package.name
+                       local name_len = #package.name
+                       if package.type == "game" and name_len > 5 and package.name:sub(name_len - 4) == "_game" then
+                               package.id = package.author .. "/" .. package.name:sub(1, name_len - 5)
+                       else
+                               package.id = package.author .. "/" .. package.name
+                       end
                end
 
                store.packages = store.packages_full