mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 15:15:44 -03:00
Fix symbolic links issue
This commit is contained in:
27
config.py
27
config.py
@@ -109,30 +109,11 @@ class Config:
|
|||||||
if not preview_path:
|
if not preview_path:
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
# 获取真实路径和规范化路径
|
real_path = os.path.realpath(preview_path).replace(os.sep, '/')
|
||||||
real_preview_path = os.path.realpath(preview_path)
|
|
||||||
normalized_real_path = real_preview_path.replace(os.sep, '/')
|
|
||||||
normalized_preview_path = preview_path.replace(os.sep, '/')
|
|
||||||
|
|
||||||
# 首先尝试使用原始路径查找路由
|
for path, route in self._route_mappings.items():
|
||||||
for root_path, route in self._route_mappings.items():
|
if real_path.startswith(path):
|
||||||
if normalized_preview_path.startswith(root_path):
|
relative_path = os.path.relpath(real_path, path)
|
||||||
relative_path = os.path.relpath(normalized_preview_path, root_path)
|
|
||||||
return f'{route}/{relative_path.replace(os.sep, "/")}'
|
|
||||||
|
|
||||||
# 如果没找到,尝试使用真实路径查找路由
|
|
||||||
for root_path, route in self._route_mappings.items():
|
|
||||||
if normalized_real_path.startswith(root_path):
|
|
||||||
relative_path = os.path.relpath(normalized_real_path, root_path)
|
|
||||||
return f'{route}/{relative_path.replace(os.sep, "/")}'
|
|
||||||
|
|
||||||
# 如果还没找到,尝试使用路径映射
|
|
||||||
mapped_path = self.map_path_to_link(real_preview_path)
|
|
||||||
normalized_mapped_path = mapped_path.replace(os.sep, '/')
|
|
||||||
|
|
||||||
for root_path, route in self._route_mappings.items():
|
|
||||||
if normalized_mapped_path.startswith(root_path):
|
|
||||||
relative_path = os.path.relpath(normalized_mapped_path, root_path)
|
|
||||||
return f'{route}/{relative_path.replace(os.sep, "/")}'
|
return f'{route}/{relative_path.replace(os.sep, "/")}'
|
||||||
|
|
||||||
return ""
|
return ""
|
||||||
|
|||||||
Reference in New Issue
Block a user