diff --git a/README.md b/README.md index 39e4f68..6f891f6 100644 --- a/README.md +++ b/README.md @@ -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//`, writes a +config into `~/.local/share/warp-engine-store/-retroarch/`, writes a `-retroarch-store` launcher into `~/.local/bin`, prints the paths it resolved and runs the first sync. +The store home is `-retroarch`, not ``: 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 diff --git a/install.sh b/install.sh index ebe67bc..a1a0c93 100755 --- a/install.sh +++ b/install.sh @@ -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 [local override] diff --git a/uninstall.sh b/uninstall.sh index 45c1e55..2d804ba 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -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 + # `-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"