Skip to content

Commit d05e4ca

Browse files
Use configured downloads path, fall back on data folder if it is not writeable.
1 parent f8eb05f commit d05e4ca

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/gpodder/core.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,24 @@ def __init__(self,
6666
# Downloads go to <data_home> or $GPODDER_DOWNLOAD_DIR
6767
self.downloads = os.environ.get('GPODDER_DOWNLOAD_DIR', os.path.join(self.data_home))
6868

69+
# Read config and change default directories where needed
70+
self.config = config_class(config_file)
71+
72+
if self.config.fs.downloads != '':
73+
self.downloads = self.config.fs.downloads
74+
6975
# Initialize the gPodder home directories
7076
util.make_directory(self.data_home)
7177
util.make_directory(self.config_home)
7278

79+
if self.data_home != self.downloads:
80+
if not util.make_directory(self.downloads):
81+
self.logger.warn('Custom downloads path [%s] not writable reverting to default', self.downloads)
82+
self.downloads = os.environ.get('GPODDER_DOWNLOAD_DIR', os.path.join(self.data_home))
83+
7384
# Open the database and configuration file
7485
self.db = database_class(database_file, verbose)
7586
self.model = model_class(self)
76-
self.config = config_class(config_file)
7787

7888
# Load installed/configured plugins
7989
self._load_plugins()

0 commit comments

Comments
 (0)