From c7b4a6e118f664ff53ef960f139d426a790a20f8 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Tue, 14 Jul 2026 14:51:15 +0200 Subject: [PATCH] Config: Replace __is_abs() with os.path.isabs() The __is_abs() helper duplicates os.path.isabs() logic. Replace it with the standard library function, guarding for None/empty strings to match the original helper safety behavior. Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL with pi.dev v Signed-off-by: Jan Lindemann --- src/python/jw/util/Config.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/python/jw/util/Config.py b/src/python/jw/util/Config.py index 5ec6352..8102a09 100644 --- a/src/python/jw/util/Config.py +++ b/src/python/jw/util/Config.py @@ -14,15 +14,6 @@ class Config(): # export def __load(self, search_dirs, glob_paths, refuse_mode_mask): - def __is_abs(path): - if path is None: - return False - if len(path) == 0: - return False - if path[0] != '/': - return False - return True - ret = StringTree("", "") exe = Path(os.path.basename(sys.argv[0])).stem if glob_paths is None: @@ -37,7 +28,10 @@ class Config(): # export for path in glob_paths: dirs = search_dirs if dirs is None: - dirs = [''] if __is_abs(path) else [str(Path.home()), str(Path.cwd())] + if path and os.path.isabs(path): + dirs = [''] + else: + dirs = [str(Path.home()), str(Path.cwd())] for d in dirs: g = d + '/' + path if len(d) else path slog(DEBUG, 'Looking for config "{}"'.format(g))