diff --git a/liquidctl/keyval.py b/liquidctl/keyval.py index a1e71bf67..6efe6c782 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 = [] @@ -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)