Skip to content

Commit

Permalink
support XDG_CONFIG_HOME (closes #1545)
Browse files Browse the repository at this point in the history
This will only load either
${XDG_CONFIG_HOME}/gallery-dl/config.json or
${HOME}/.config/gallery-dl/config.json
if XDG_CONFIG_HOME is empty, never both.
  • Loading branch information
mikf committed May 16, 2021
1 parent 41457db commit 3a7c3ff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ Windows:

Linux, macOS, etc.:
* ``/etc/gallery-dl.conf``
* ``${XDG_CONFIG_HOME}/gallery-dl/config.json``
* ``${HOME}/.config/gallery-dl/config.json``
* ``${HOME}/.gallery-dl.conf``

Expand Down
4 changes: 3 additions & 1 deletion gallery_dl/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

# Copyright 2015-2020 Mike Fährmann
# Copyright 2015-2021 Mike Fährmann
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
Expand Down Expand Up @@ -31,6 +31,8 @@
else:
_default_configs = [
"/etc/gallery-dl.conf",
"${XDG_CONFIG_HOME}/gallery-dl/config.json"
if os.environ.get("XDG_CONFIG_HOME") else
"${HOME}/.config/gallery-dl/config.json",
"${HOME}/.gallery-dl.conf",
]
Expand Down

0 comments on commit 3a7c3ff

Please sign in to comment.