From 375fed7bf646ad6f6c2249accd1386fc8a920963 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Sun, 23 Oct 2016 06:41:33 +0000 Subject: [PATCH] store our system and user config and log files in an "Xpra" subdirectory git-svn-id: https://xpra.org/svn/Xpra/trunk@14268 3bb7dfac-3a0b-4e04-842a-767bc560f471 --- src/xpra/platform/darwin/paths.py | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/xpra/platform/darwin/paths.py b/src/xpra/platform/darwin/paths.py index d8c9fd5412..135f24e893 100644 --- a/src/xpra/platform/darwin/paths.py +++ b/src/xpra/platform/darwin/paths.py @@ -75,23 +75,30 @@ def do_get_default_conf_dirs(): def do_get_system_conf_dirs(): #the system wide configuration directory + dirs = [] try: from Foundation import NSSearchPathForDirectoriesInDomains, NSApplicationSupportDirectory, NSLocalDomainMask, NSSystemDomainMask #@UnresolvedImport - dirs = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSLocalDomainMask|NSSystemDomainMask, False) - return list(dirs) + sdirs = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSLocalDomainMask|NSSystemDomainMask, False) + for x in sdirs: + #ie: "/Library/Application Support/Xpra" + dirs.append(os.path.join(x, "Xpra")) except: - pass - #fallback to hardcoded: - default_conf_dir = "/Library/Application Support/Xpra" - return [os.environ.get("XPRA_SYSCONF_DIR", default_conf_dir)] + #fallback to hardcoded: + default_conf_dir = "/Library/Application Support/Xpra" + dirs = [os.environ.get("XPRA_SYSCONF_DIR", default_conf_dir)] + dirs.append("/etc/xpra") + return dirs def do_get_user_conf_dirs(): #the system wide configuration directory + dirs = [] try: #when running sandboxed, it may look like this: #~/Library/Containers//Data/Library/Application Support/ from Foundation import NSSearchPathForDirectoriesInDomains, NSApplicationSupportDirectory, NSUserDomainMask #@UnresolvedImport - dirs = list(NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, False)) + udirs = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, False) + for x in udirs: + dirs.append(os.path.join(x, "Xpra")) except: #fallback to hardcoded: dirs = ["/Library/Application Support/Xpra"] @@ -103,12 +110,11 @@ def do_get_default_log_dirs(): try: from Foundation import NSSearchPathForDirectoriesInDomains, NSLibraryDirectory, NSUserDomainMask #@UnresolvedImport udirs = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, False) - #ie: ~/Library/ - library_dir = udirs[0] - dirs.append(os.path.join(library_dir, "Xpra")) + for x in udirs: + #ie: ~/Library/ + dirs.append(os.path.join(x, "Logs", "Xpra")) except: - pass - dirs.append("~/Library/Logs") + dirs.append("~/Library/Logs/Xpra") dirs.append("/tmp") return dirs