~mil/mepo-devel

Use XDG_CACHE_HOME consistently v1 PROPOSED

Robert Günzler: 1
 Use XDG_CACHE_HOME consistently

 4 files changed, 12 insertions(+), 12 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~mil/mepo-devel/patches/55175/mbox | git am -3
Learn more about email & git

[PATCH] Use XDG_CACHE_HOME consistently Export this patch

previously only the save/load state scripts actually respected the
variable, which breaks the routeing scripts. which both assume ~/.cache

Signed-off-by: Robert Günzler <r@gnzler.io>
---
 scripts/mepo_ui_menu_pref_stateload.sh    |  2 +-
 scripts/mepo_ui_menu_pref_statesave.sh    |  2 +-
 scripts/mepo_ui_menu_route_graphhopper.sh | 10 +++++-----
 scripts/mepo_ui_menu_route_mobroute.sh    | 10 +++++-----
 4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/scripts/mepo_ui_menu_pref_stateload.sh b/scripts/mepo_ui_menu_pref_stateload.sh
index ae20341..0976816 100755
--- a/scripts/mepo_ui_menu_pref_stateload.sh
+++ b/scripts/mepo_ui_menu_pref_stateload.sh
@@ -2,7 +2,7 @@
DISPLAYNAME="↺ State: Load"
HOTKEY=u
DOC='
  Loads the state (pins & preferences) from ~/.cache/mepo/savestate.json
  Loads the state (pins & preferences) from $XDG_CACHE_HOME/mepo/savestate.json
'

main() {
diff --git a/scripts/mepo_ui_menu_pref_statesave.sh b/scripts/mepo_ui_menu_pref_statesave.sh
index 4a5bc2d..3dccef8 100755
--- a/scripts/mepo_ui_menu_pref_statesave.sh
+++ b/scripts/mepo_ui_menu_pref_statesave.sh
@@ -2,7 +2,7 @@
DISPLAYNAME="↻ State: Save"
HOTKEY=i
DOC='
  Saves the state (pins & preferences) to ~/.cache/mepo/savestate.json
  Saves the state (pins & preferences) to $XDG_CACHE_HOME/mepo/savestate.json
'

main() {
diff --git a/scripts/mepo_ui_menu_route_graphhopper.sh b/scripts/mepo_ui_menu_route_graphhopper.sh
index 88dda76..e1be865 100755
--- a/scripts/mepo_ui_menu_route_graphhopper.sh
+++ b/scripts/mepo_ui_menu_route_graphhopper.sh
@@ -22,7 +22,7 @@ errdie() {

errcheckhastwopins() {
  NPINS="$(
    cat ~/.cache/mepo/shellpipe_savestate.json |
    cat $XDG_CACHE_HOME/mepo/shellpipe_savestate.json |
      jq "[.[] | select(.cmd == \"pin_add\" and .args.group == $MEPO_PINGROUPACTIVE)] | length"
  )"

@@ -35,12 +35,12 @@ errcheckhastwopins() {

gettablevals() {
  JSONPIN0="$(
    cat ~/.cache/mepo/shellpipe_savestate.json |
    jq "[.[] | select(.cmd == \"pin_add\" and .args.group == $MEPO_PINGROUPACTIVE)] | first"
    cat $XDG_CACHE_HOME/mepo/shellpipe_savestate.json |
      jq "[.[] | select(.cmd == \"pin_add\" and .args.group == $MEPO_PINGROUPACTIVE)] | first"
  )"
  JSONPIN1="$(
    cat ~/.cache/mepo/shellpipe_savestate.json |
    jq "[.[] | select(.cmd == \"pin_add\" and .args.group == $MEPO_PINGROUPACTIVE)] | last"
    cat $XDG_CACHE_HOME/mepo/shellpipe_savestate.json |
      jq "[.[] | select(.cmd == \"pin_add\" and .args.group == $MEPO_PINGROUPACTIVE)] | last"
  )"
  COORDFROM="$(echo "$JSONPIN0" | jq '(.args.lat|tostring) + ", " + (.args.lon|tostring)' |tr -d '"')"
  COORDTO="$(echo "$JSONPIN1" | jq '(.args.lat|tostring) + ", " + (.args.lon|tostring)' |tr -d '"')"
diff --git a/scripts/mepo_ui_menu_route_mobroute.sh b/scripts/mepo_ui_menu_route_mobroute.sh
index 002edfe..486de2a 100755
--- a/scripts/mepo_ui_menu_route_mobroute.sh
+++ b/scripts/mepo_ui_menu_route_mobroute.sh
@@ -40,7 +40,7 @@ ensurehasmobroute() {

errcheckhastwopins() {
  NPINS="$(
    cat ~/.cache/mepo/shellpipe_savestate.json |
    cat $XDG_CACHE_HOME/mepo/shellpipe_savestate.json |
      jq "[.[] | select(.cmd == \"pin_add\" and .args.group == $MEPO_PINGROUPACTIVE)] | length"
  )"

@@ -53,12 +53,12 @@ errcheckhastwopins() {

gettablevals() {
  JSONPIN0="$(
    cat ~/.cache/mepo/shellpipe_savestate.json |
    jq "[.[] | select(.cmd == \"pin_add\" and .args.group == $MEPO_PINGROUPACTIVE)] | first"
    cat $XDG_CACHE_HOME/mepo/shellpipe_savestate.json |
      jq "[.[] | select(.cmd == \"pin_add\" and .args.group == $MEPO_PINGROUPACTIVE)] | first"
  )"
  JSONPIN1="$(
    cat ~/.cache/mepo/shellpipe_savestate.json |
    jq "[.[] | select(.cmd == \"pin_add\" and .args.group == $MEPO_PINGROUPACTIVE)] | last"
    cat $XDG_CACHE_HOME/mepo/shellpipe_savestate.json |
      jq "[.[] | select(.cmd == \"pin_add\" and .args.group == $MEPO_PINGROUPACTIVE)] | last"
  )"
  DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
  COORDFROM="$(echo "$JSONPIN0" | jq '(.args.lat|tostring) + ", " + (.args.lon|tostring)' |tr -d '"')"

base-commit: c1807b103f9019f647b80294b9001114a5fd3464
-- 
2.44.2