From a9d750a5faf995e55fb6c68bede1b8f4712a0361 Mon Sep 17 00:00:00 2001 From: Johan Viirok Date: Fri, 28 Aug 2020 09:38:22 +0300 Subject: [PATCH 1/2] Fix user home path for macos --- liquidctl/keyval.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/liquidctl/keyval.py b/liquidctl/keyval.py index a1e71bf67..8c2d787be 100644 --- a/liquidctl/keyval.py +++ b/liquidctl/keyval.py @@ -23,7 +23,7 @@ def get_runtime_dirs(appname='liquidctl'): if sys.platform == 'win32': dirs = [os.path.join(os.getenv('TEMP'), appname)] elif sys.platform == 'darwin': - dirs = [os.path.join('~/Library/Caches', appname)] + dirs = [os.path.expanduser(os.path.join('~/Library/Caches', appname))] elif sys.platform == 'linux': # threat all other platforms as *nix and conform to XDG basedir spec dirs = [] From 7d1968a1090a6142c14ebaa07cb50e0d1f83f186 Mon Sep 17 00:00:00 2001 From: Johan Viirok Date: Fri, 28 Aug 2020 12:49:24 +0300 Subject: [PATCH 2/2] Fix user home path for macos --- liquidctl/keyval.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/liquidctl/keyval.py b/liquidctl/keyval.py index 8c2d787be..6efe6c782 100644 --- a/liquidctl/keyval.py +++ b/liquidctl/keyval.py @@ -56,7 +56,7 @@ def __init__(self, key_prefixes): self._read_dirs = [os.path.join(x, *key_prefixes) for x in get_runtime_dirs()] self._write_dir = self._read_dirs[0] os.makedirs(self._write_dir, exist_ok=True) - if XDG_RUNTIME_DIR and os.path.commonpath([XDG_RUNTIME_DIR, self._write_dir]): + if sys.platform == 'linux': # set the sticky bit to prevent removal during cleanup os.chmod(self._write_dir, 0o1700) LOGGER.debug('data in %s (within XDG_RUNTIME_DIR)', self._write_dir)