]> git.armaanb.net Git - lightcards.git/blobdiff - lightcards/config.py
Exit if specified config file does not exist
[lightcards.git] / lightcards / config.py
index 2b8b93880d6707e15f958507200338b1ab211d8a..04cfdf99627f108ccc12fafb0d0506d3c194d919 100644 (file)
@@ -27,8 +27,10 @@ def read_file(file):
         files.append(local_xdg)
     if os.path.exists(local):
         files.append(local)
         files.append(local_xdg)
     if os.path.exists(local):
         files.append(local)
-    if os.path.exists(file):
-        files.append(file)
+
+    files.append(file)
+    if not os.path.exists(file):
+        raise ConfigException(f'"{file}": No such file or directory') from None
 
     for f in files:
         exec(Path(str(f)).read_text(), {}, config)
 
     for f in files:
         exec(Path(str(f)).read_text(), {}, config)