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
|
|
@ -4,14 +4,38 @@ import json
|
|||
import math
|
||||
import os
|
||||
import struct
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
WORKBENCH = os.environ.get(
|
||||
"RINKPLANNER_WORKBENCH",
|
||||
os.path.expanduser("~/Documents/workbench_rinkplanner"),
|
||||
def documents_dir() -> str:
|
||||
"""Dokumente-Ordner des Benutzers; der Name hängt von der Sprache ab."""
|
||||
home = os.path.expanduser("~")
|
||||
try:
|
||||
result = subprocess.run(
|
||||
["xdg-user-dir", "DOCUMENTS"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
except OSError:
|
||||
result = None
|
||||
if result is not None and result.returncode == 0:
|
||||
candidate = result.stdout.strip()
|
||||
# xdg-user-dir liefert $HOME, wenn kein Ordner konfiguriert ist.
|
||||
if candidate and candidate != home and os.path.isdir(candidate):
|
||||
return candidate
|
||||
for name in ("Dokumente", "Documents"):
|
||||
candidate = os.path.join(home, name)
|
||||
if os.path.isdir(candidate):
|
||||
return candidate
|
||||
return os.path.join(home, "Documents")
|
||||
|
||||
|
||||
WORKBENCH = os.environ.get("RINKPLANNER_WORKBENCH") or os.path.join(
|
||||
documents_dir(), "workbench_rinkplanner"
|
||||
)
|
||||
DEFAULT_RIG = os.path.join(
|
||||
WORKBENCH, "source", "characters", "skater", "skater_rig_v006.blend"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue