1
0
Fork 0
mirror of synced 2024-06-25 17:40:17 +12:00

Load config from arguments first

This commit is contained in:
Serene-Arc 2021-03-11 11:21:50 +10:00 committed by Ali Parlakci
parent 50531c7b3e
commit 3703d2b9b9

View file

@ -124,6 +124,13 @@ class RedditDownloader:
def _load_config(self):
self.cfg_parser = configparser.ConfigParser()
if self.args.config:
if (cfg_path := Path(self.args.config)).exists():
self.cfg_parser.read(cfg_path)
self.config_location = cfg_path
return
else:
logger.error(f'Could not find config file at {self.args.config}, attempting to find elsewhere')
possible_paths = [Path('./config.cfg'),
Path(self.config_directory, 'config.cfg'),
Path('./default_config.cfg'),