fix: Dokumente-Ordner sprachunabhaengig aufloesen
- neues tools/_paths.sh loest den Dokumente-Ordner zur Laufzeit auf: xdg-user-dir DOCUMENTS, sonst ~/Dokumente, sonst ~/Documents - sync_assets.sh und rotoscope.sh nutzen workbench_dir statt $HOME/Documents/workbench_rinkplanner - promote_rotoscope.py und blender/rotoscope.py loesen den Workbench-Pfad genauso auf und bevorzugen weiterhin RINKPLANNER_WORKBENCH - Doku auf den tatsaechlichen Pfad ~/Dokumente/workbench_rinkplanner umgestellt
This commit is contained in:
parent
c3677bf3e1
commit
0ac0624ba2
9 changed files with 108 additions and 14 deletions
39
tools/_paths.sh
Normal file
39
tools/_paths.sh
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/env bash
|
||||
# Gemeinsame Pfad-Helfer. Wird gesourct, nicht direkt ausgeführt.
|
||||
|
||||
# documents_dir
|
||||
# Liefert den Dokumente-Ordner des Benutzers. Der Verzeichnisname hängt von
|
||||
# der Systemsprache ab (XDG, z. B. ~/Dokumente oder ~/Documents) und wird
|
||||
# deshalb zur Laufzeit aufgelöst.
|
||||
documents_dir() {
|
||||
local candidate=""
|
||||
|
||||
if command -v xdg-user-dir >/dev/null 2>&1; then
|
||||
candidate="$(xdg-user-dir DOCUMENTS 2>/dev/null || true)"
|
||||
# xdg-user-dir liefert $HOME, wenn kein Dokumente-Ordner konfiguriert ist.
|
||||
if [[ -n "$candidate" && "$candidate" != "$HOME" && -d "$candidate" ]]; then
|
||||
printf '%s\n' "$candidate"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
for candidate in "$HOME/Dokumente" "$HOME/Documents"; do
|
||||
if [[ -d "$candidate" ]]; then
|
||||
printf '%s\n' "$candidate"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
printf '%s\n' "$HOME/Documents"
|
||||
}
|
||||
|
||||
# workbench_dir
|
||||
# Pfad zum Workbench-Archiv: RINKPLANNER_WORKBENCH oder
|
||||
# <Dokumente>/workbench_rinkplanner.
|
||||
workbench_dir() {
|
||||
if [[ -n "${RINKPLANNER_WORKBENCH:-}" ]]; then
|
||||
printf '%s\n' "$RINKPLANNER_WORKBENCH"
|
||||
else
|
||||
printf '%s\n' "$(documents_dir)/workbench_rinkplanner"
|
||||
fi
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue