Skip to content

Commit

Permalink
#1129 enable /var/run/$UID/xpra for run-xpra script location and log …
Browse files Browse the repository at this point in the history
…files

git-svn-id: https://xpra.org/svn/Xpra/trunk@13344 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Aug 14, 2016
1 parent ffa31c1 commit c392896
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/xpra/platform/xposix/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down Expand Up @@ -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"
Expand All @@ -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):
Expand All @@ -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"

0 comments on commit c392896

Please sign in to comment.