From b80bb2fcfcceb9b00a3fec02280e93da33ba8bd0 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Tue, 3 Jul 2018 12:32:31 +0200 Subject: Only create the config dir after parsing the CLI args. This also switches to pathlib.Path instead of os.path for path manipulation. --- poezio/args.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'poezio/args.py') diff --git a/poezio/args.py b/poezio/args.py index 71ae7488..31525bb2 100644 --- a/poezio/args.py +++ b/poezio/args.py @@ -3,11 +3,11 @@ Module related to the argument parsing There is a fallback to the deprecated optparse if argparse is not found """ -from os import path +from pathlib import Path from argparse import ArgumentParser, SUPPRESS -def parse_args(CONFIG_PATH=''): +def parse_args(CONFIG_PATH: Path): """ Parse the arguments from the command line """ @@ -28,7 +28,8 @@ def parse_args(CONFIG_PATH=''): "-f", "--file", dest="filename", - default=path.join(CONFIG_PATH, 'poezio.cfg'), + default=CONFIG_PATH / 'poezio.cfg', + type=Path, help="The config file you want to use", metavar="CONFIG_FILE") parser.add_argument( -- cgit v1.2.3