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:
parent
f9f10f9b9e
commit
c7b4a6e118
1 changed files with 4 additions and 10 deletions
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Reference in a new issue