Install games to persistent user://butler/games and reconcile orphaned caves

OGPU moves the whole extracted plugin directory (plugins/itch/) to trash
on every plugin update, so keeping installed games under
user://plugins/itch/games meant game files silently vanished on update
while butler.db kept the (now orphaned) cave. That made fresh installs
fail with butlerd's "That upload is already installed!" and broke
launches for games whose files were gone.

- New installs go to user://butler/games (persistent, next to butler.db)
  via a reworked _ensure_install_location; prereqs move there too
- _install/_update reconcile the cave first: a cave whose install folder
  no longer exists is uninstalled before a fresh (re)install, and a valid
  existing cave turns the request into an update instead
- _make_item treats missing-folder caves as not installed, and the cache
  path re-checks cwd so stale caches don't render a broken Play button
- orphaned caves are cleaned out of butler.db in the background on library
  load
- drop the plugin's global InstallLocation class stub: it collided with
  OGPU core's nested Library.InstallLocation and broke compilation on a
  cold .godot cache (the unused install_to arg is now untyped)
- Makefile: compute preset number with shell arithmetic instead of bc
This commit is contained in:
Jose Falanga 2026-08-07 22:48:17 -03:00
parent 7d5dedc0b9
commit 3473073582
4 changed files with 119 additions and 25 deletions

View file

@ -60,7 +60,7 @@ $(PLUGINS_DIR)/$(PLUGIN_ID): $(OPENGAMEPAD_UI_BASE)
export_preset: $(OPENGAMEPAD_UI_BASE) ## Configure plugin export preset
$(eval LAST_PRESET=$(shell grep -oEi '^\[preset\.([0-9]+)]' $(EXPORT_PRESETS) | tail -n 1))
$(eval LAST_PRESET_NUM=$(shell echo "$(LAST_PRESET)" | grep -oE '([0-9]+)'))
$(eval PRESET_NUM=$(shell echo "$(LAST_PRESET_NUM)+1" | bc))
$(eval PRESET_NUM=$(shell echo "$$(($(LAST_PRESET_NUM)+1))"))
@if grep 'name="$(PLUGIN_NAME)"' $(EXPORT_PRESETS) > /dev/null; then \
echo "Export preset already configured"; \
else \