From f563c1e98b1be7975505ca6a3e94a3318412cdcf Mon Sep 17 00:00:00 2001
From: Mattias Andrée <maandree@operamail.com>
Date: Thu, 10 Apr 2014 22:13:32 +0200
Subject: m
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Mattias Andrée <maandree@operamail.com>
---
 src/nightshift.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

(limited to 'src/nightshift.py')

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):
-- 
cgit v1.2.3-70-g09d2