add_model_folder_path: ensure unique paths by removing duplicates

Signed-off-by: bigcat88 <bigcat88@icloud.com>
This commit is contained in:
Alexander Piskun 2024-12-10 14:05:53 +02:00 committed by bigcat88
parent a220d11e6b
commit 07ca2c7816
No known key found for this signature in database
GPG Key ID: 1F0BF0EC3CF22721

View File

@ -200,6 +200,10 @@ def add_model_folder_path(folder_name: str, full_folder_path: str, is_default: b
global folder_names_and_paths
folder_name = map_legacy(folder_name)
if folder_name in folder_names_and_paths:
current_paths = folder_names_and_paths[folder_name][0]
if full_folder_path in current_paths:
current_paths.remove(full_folder_path) # Remove the path if it exists
if is_default:
folder_names_and_paths[folder_name][0].insert(0, full_folder_path)
else: