- 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
39 lines
1.1 KiB
Bash
39 lines
1.1 KiB
Bash
#!/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
|
|
}
|