diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-04-10 22:13:32 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-04-10 22:14:41 +0200 |
commit | f563c1e98b1be7975505ca6a3e94a3318412cdcf (patch) | |
tree | 89f8110d06315132466471d92adbe0f709c8c176 | |
parent | make the size of the backlog configurable (diff) | |
download | nightshift-f563c1e98b1be7975505ca6a3e94a3318412cdcf.tar.gz nightshift-f563c1e98b1be7975505ca6a3e94a3318412cdcf.tar.bz2 nightshift-f563c1e98b1be7975505ca6a3e94a3318412cdcf.tar.xz |
m
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rwxr-xr-x | src/nightshift.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/nightshift.py b/src/nightshift.py index b9b8e7a..9d99f1b 100755 --- a/src/nightshift.py +++ b/src/nightshift.py @@ -597,22 +597,25 @@ if config_file is None: except: return else: + # Resolve environment variable or use empty string if none is selected if (var is None) or (var in os.environ) and (not os.environ[var] == ''): var = '' if var is None else os.environ[var] else: return paths = [var] + # Split environment variable value if it is a multi valeu variable if multi and os.pathsep in var: paths = [v for v in var.split(os.pathsep) if not v == ''] + # Add files according to patterns for p in ps: p = p.replace('/', os.sep).replace('%', PROGRAM_NAME) for v in paths: files.append(v + p) - add_files('XDG_CONFIG_HOME', '/%/%rc') - add_files('HOME', '/.config/%/%rc', '/.%rc') - add_files('~', '/.config/%/%rc', '/.%rc') - add_files('XDG_CONFIG_DIRS', '/.config/%/%rc', '/.%rc', multi = True) - add_files(None, '/etc/%rc') + add_files('XDG_CONFIG_HOME', '/%/%rc', '/%rc') + add_files('HOME', '/.config/%/%rc', '/.%rc') + add_files('~', '/.config/%/%rc', '/.%rc') + add_files('XDG_CONFIG_DIRS', '/%rc', multi = True) + add_files(None, '/etc/%rc') for file in files: # If the file we exists, if os.path.exists(file): |