Skip to content

Commit 944e9f5

Browse files
rubenwardyparamat
authored andcommitted
Content store: Use composite key to track installations (#8054)
Fixes #7967 'Package manager doesn't track content reliably'.
1 parent d9f5ff4 commit 944e9f5

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

builtin/mainmenu/dlg_contentstore.lua

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,8 @@ function store.load()
300300
package.url = base_url .. "/packages/" ..
301301
package.author .. "/" .. package.name ..
302302
"/releases/" .. package.release .. "/download/"
303+
304+
package.id = package.author .. "/" .. package.name
303305
end
304306

305307
store.packages = store.packages_full
@@ -314,38 +316,38 @@ function store.update_paths()
314316
pkgmgr.refresh_globals()
315317
for _, mod in pairs(pkgmgr.global_mods:get_list()) do
316318
if mod.author then
317-
mod_hash[mod.name] = mod
319+
mod_hash[mod.author .. "/" .. mod.name] = mod
318320
end
319321
end
320322

321323
local game_hash = {}
322324
pkgmgr.update_gamelist()
323325
for _, game in pairs(pkgmgr.games) do
324326
if game.author then
325-
game_hash[game.id] = game
327+
game_hash[game.author .. "/" .. game.id] = game
326328
end
327329
end
328330

329331
local txp_hash = {}
330332
for _, txp in pairs(pkgmgr.get_texture_packs()) do
331333
if txp.author then
332-
txp_hash[txp.name] = txp
334+
txp_hash[txp.author .. "/" .. txp.name] = txp
333335
end
334336
end
335337

336338
for _, package in pairs(store.packages_full) do
337339
local content
338340
if package.type == "mod" then
339-
content = mod_hash[package.name]
341+
content = mod_hash[package.id]
340342
elseif package.type == "game" then
341-
content = game_hash[package.name]
343+
content = game_hash[package.id]
342344
elseif package.type == "txp" then
343-
content = txp_hash[package.name]
345+
content = txp_hash[package.id]
344346
end
345347

346-
if content and content.author == package.author then
348+
if content then
347349
package.path = content.path
348-
package.installed_release = content.release
350+
package.installed_release = content.release or 0
349351
else
350352
package.path = nil
351353
end

0 commit comments

Comments
 (0)