Give the store home its own name per engine
The desktop engine shares this store root, and both keyed their home by the store id alone — so installing both from the same publisher meant one config.json and one state.json between them, and the second install silently adopted the first one's state. Caught by installing the two side by side. The home is now `<id>-retroarch`. The installer moves an existing `<id>` home on its way past, so an install from yesterday keeps its state and its games; the uninstaller accepts either name. The launcher was already `<id>-retroarch-store`, so nothing the user types changes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -77,10 +77,14 @@ STORE_CONFIG=./my-config.json ./install.sh
|
||||
```
|
||||
|
||||
It reads `store.id` from the config, installs the engine, the shared core and the
|
||||
config into `~/.local/share/warp-engine-store/<id>/`, writes a
|
||||
config into `~/.local/share/warp-engine-store/<id>-retroarch/`, writes a
|
||||
`<id>-retroarch-store` launcher into `~/.local/bin`, prints the paths it resolved
|
||||
and runs the first sync.
|
||||
|
||||
The store home is `<id>-retroarch`, not `<id>`: the desktop store engine shares
|
||||
this root, and a shared home would mean a shared `config.json` and `state.json`.
|
||||
An install from before this change is moved on the next run of the installer.
|
||||
|
||||
| Environment variable | Meaning |
|
||||
|---|---|
|
||||
| `STORE_CONFIG` | **required** — path or URL of the store's `config.json` |
|
||||
@@ -159,7 +163,7 @@ curl -fsSL https://git.teletypegames.org/engines/warpstore/raw/branch/master/uni
|
||||
## Where things land
|
||||
|
||||
```
|
||||
~/.local/share/warp-engine-store/example/
|
||||
~/.local/share/warp-engine-store/example-retroarch/
|
||||
├── retroarch_store.py, warpstore.py, config.json
|
||||
└── state.json, catalog.json
|
||||
|
||||
|
||||
+10
-1
@@ -57,9 +57,18 @@ print(sid, cfg.get("name") or sid)
|
||||
STORE_ID="${STORE_META%% *}"
|
||||
STORE_NAME="${STORE_META#* }"
|
||||
|
||||
STORE_HOME="$STORE_ROOT/$STORE_ID"
|
||||
# One home per engine: the desktop store shares this root, and a shared home
|
||||
# would mean a shared config.json and state.json.
|
||||
STORE_HOME="$STORE_ROOT/$STORE_ID-retroarch"
|
||||
LAUNCHER="$BIN_DIR/$STORE_ID-retroarch-store"
|
||||
|
||||
# Installs from before the rename kept the home under the bare store id.
|
||||
LEGACY_HOME="$STORE_ROOT/$STORE_ID"
|
||||
if [ -d "$LEGACY_HOME" ] && [ -f "$LEGACY_HOME/retroarch_store.py" ] && [ ! -d "$STORE_HOME" ]; then
|
||||
say "moving $LEGACY_HOME -> $STORE_HOME (one home per engine)"
|
||||
mv "$LEGACY_HOME" "$STORE_HOME"
|
||||
fi
|
||||
|
||||
mkdir -p "$STORE_HOME" "$BIN_DIR"
|
||||
|
||||
install_file() { # install_file <name> <raw base> [local override]
|
||||
|
||||
+7
-3
@@ -51,8 +51,10 @@ if [ -z "$STORE_ID" ]; then
|
||||
FOUND=""
|
||||
COUNT=0
|
||||
for d in "$STORE_ROOT"/*/; do
|
||||
if [ -f "$d/config.json" ]; then
|
||||
FOUND="$FOUND $(basename "$d")"
|
||||
if [ -f "$d/retroarch_store.py" ]; then
|
||||
# `<id>-retroarch` is the home; the store id is what the user types.
|
||||
name="$(basename "$d")"
|
||||
FOUND="$FOUND ${name%-retroarch}"
|
||||
COUNT=$((COUNT + 1))
|
||||
fi
|
||||
done
|
||||
@@ -63,7 +65,9 @@ if [ -z "$STORE_ID" ]; then
|
||||
esac
|
||||
fi
|
||||
|
||||
STORE_HOME="$STORE_ROOT/$STORE_ID"
|
||||
STORE_HOME="$STORE_ROOT/$STORE_ID-retroarch"
|
||||
# Installs from before the rename kept the home under the bare store id.
|
||||
[ -d "$STORE_HOME" ] || [ ! -f "$STORE_ROOT/$STORE_ID/retroarch_store.py" ] || STORE_HOME="$STORE_ROOT/$STORE_ID"
|
||||
LAUNCHER="$BIN_DIR/$STORE_ID-retroarch-store"
|
||||
[ -d "$STORE_HOME" ] || die "no store '$STORE_ID' in $STORE_ROOT"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user