From c39289637c0e0500fe23a0bd4c6cdcc671df6ffc Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Sun, 14 Aug 2016 14:13:22 +0000 Subject: [PATCH] #1129 enable /var/run/$UID/xpra for run-xpra script location and log files git-svn-id: https://xpra.org/svn/Xpra/trunk@13344 3bb7dfac-3a0b-4e04-842a-767bc560f471 --- src/xpra/platform/xposix/paths.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/xpra/platform/xposix/paths.py b/src/xpra/platform/xposix/paths.py index 4d8acfeb18..a6582cb4c8 100644 --- a/src/xpra/platform/xposix/paths.py +++ b/src/xpra/platform/xposix/paths.py @@ -8,8 +8,8 @@ import site -USE_RUNTIME_LOG_DIR = os.environ.get("XPRA_USE_RUNTIME_LOG_DIR", "0")=="1" -USE_RUNTIME_BIN_DIR = os.environ.get("XPRA_USE_RUNTIME_BIN_DIR", "0")=="1" +USE_RUNTIME_LOG_DIR = os.environ.get("XPRA_USE_RUNTIME_LOG_DIR", "1")=="1" +USE_RUNTIME_BIN_DIR = os.environ.get("XPRA_USE_RUNTIME_BIN_DIR", "1")=="1" USE_RUNTIME_SOCKET_DIR = os.environ.get("XPRA_USE_RUNTIME_SOCKET_DIR", "1")=="1" @@ -62,7 +62,7 @@ def do_get_script_bin_dirs(): return script_bin_dirs -def _get_xpra_runtime_dir(): +def _get_runtime_dir(): runtime_dir = os.environ.get("XDG_RUNTIME_DIR") if runtime_dir: #replace uid with the string "$UID" @@ -74,15 +74,20 @@ def _get_xpra_runtime_dir(): pass elif os.path.exists("/var/run/user") and os.path.isdir("/var/run/user"): runtime_dir = "/var/run/user/$UID" - #print("_get_xpra_runtime_dir()=%s" % runtime_dir) return runtime_dir +def _get_xpra_runtime_dir(): + runtime_dir = _get_runtime_dir() + if not runtime_dir: + return None + return os.path.join(runtime_dir, "xpra") + def do_get_socket_dirs(): SOCKET_DIRS = [] runtime_dir = _get_xpra_runtime_dir() if USE_RUNTIME_SOCKET_DIR and runtime_dir: #private, per user: /run/user/1000/xpra - SOCKET_DIRS.append(os.path.join(runtime_dir, "xpra")) + SOCKET_DIRS.append(runtime_dir) SOCKET_DIRS.append("~/.xpra") #the old default path #for shared sockets (the 'xpra' group should own this directory): if os.path.exists("/var/run/xpra") and os.access('/var/run/xpra', os.W_OK): @@ -91,7 +96,7 @@ def do_get_socket_dirs(): return SOCKET_DIRS def do_get_default_log_dir(): - runtime_dir = os.environ.get("XDG_RUNTIME_DIR") + runtime_dir = _get_xpra_runtime_dir() if USE_RUNTIME_LOG_DIR and runtime_dir: return runtime_dir return "~/.xpra"