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 <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-07-14 14:51:15 +02:00 • committed by janware DevOps
commit c7b4a6e118
Signed by: DevOps
SSH key fingerprint: SHA256:cZiw7ExG5q3KAVm7Jse3rGITowu0VjgUgNMPbifmY8g

View file

@ -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))