From 0e8d568feaa1300971b78260b0df34541eb56e9f Mon Sep 17 00:00:00 2001 From: furtest Date: Thu, 8 Jan 2026 13:46:01 +0100 Subject: [PATCH] main : Use pathlib instead of os.path Removes every use of os.path and replaces it with the equivalent pathlib method. Allows to avoid importing os. --- src/unisync/main.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/unisync/main.py b/src/unisync/main.py index f77462d..bb64e94 100644 --- a/src/unisync/main.py +++ b/src/unisync/main.py @@ -1,7 +1,6 @@ # Copyright (C) 2025-2026 Paul Retourné # SPDX-License-Identifier: GPL-3.0-or-later -import os from pathlib import Path from unisync.argparser import create_argparser @@ -14,15 +13,15 @@ def main(): parser = create_argparser(unisync_sync, unisync_add, unisync_mount) cli_args = parser.parse_args() - config_path = os.path.expanduser("~/.config/unisync/config.ini") + config_path: Path = Path("~/.config/unisync/config.ini").expanduser() # Check if --config is set - if cli_args.config != None and os.path.isfile(cli_args.config): + if cli_args.config != None and Path(cli_args.config).is_file(): config = load_config(cli_args.config) - elif os.path.isfile(config_path): - config = load_config(config_path) + elif config_path.is_file(): + config = load_config(str(config_path)) else: # TODO replace the next line with something to do if no config file is found - config = load_config(config_path) + config = load_config(str(config_path)) pass # TODO make the command line arguments work and override the config options