From 7a3fbfeb91b3a83b092a66d11d5d1c583942dcea Mon Sep 17 00:00:00 2001 From: Rowland <975945824@qq.com> Date: Fri, 12 Dec 2025 14:53:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A8=E7=94=BB=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/property_panel.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/ui/property_panel.py b/ui/property_panel.py index 9591e401..004f1265 100644 --- a/ui/property_panel.py +++ b/ui/property_panel.py @@ -9205,24 +9205,34 @@ class PropertyPanelManager: import platform # 策略1: 处理Linux风格路径在Windows上的问题 - if platform.system() == "Windows" and filepath.startswith('/') and ':' not in filepath: + if filepath.startswith('/') and platform.system() == "Windows": + print("[路径转换] 尝试处理Linux风格路径:", filepath) path_parts = filepath.split('/') - if len(path_parts) > 2 and len(path_parts[1]) == 1: - drive_letter = path_parts[1].upper() + ':' + print(platform.system()) + if len(path_parts) > 1: + drive_letter = path_parts[1].upper() + ':\\' # 添加反斜杠确保正确路径格式 remaining_path = '\\'.join(path_parts[2:]) if len(path_parts) > 2 else '' potential_path = os.path.join(drive_letter, remaining_path) + print(f"[路径转换] 构造的潜在路径: {potential_path}") if os.path.exists(potential_path): filepath = potential_path fixed = True - print(f"[路径转换] {original_filepath} -> {filepath}") + print(f"[路径转换] 成功: {original_filepath} -> {filepath}") + else: + print(f"[路径转换] 文件不存在: {potential_path}") + # 策略2: 处理路径分隔符问题 if not fixed: # 尝试规范化路径 normalized_path = os.path.normpath(filepath) + print(f"[路径规范化] 尝试规范化路径: {filepath} -> {normalized_path}") if os.path.exists(normalized_path): filepath = normalized_path fixed = True + print(f"[路径规范化] 成功: {filepath}") + else: + print(f"[路径规范化] 文件不存在: {normalized_path}") # 策略3: 在Resources目录中查找 if not fixed: @@ -9230,9 +9240,13 @@ class PropertyPanelManager: resources_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "Resources") filename = os.path.basename(filepath) potential_path = os.path.join(resources_path, filename) + print(f"[Resources查找] 尝试在Resources目录查找: {potential_path}") if os.path.exists(potential_path): filepath = potential_path fixed = True + print(f"[Resources查找] 成功: {filepath}") + else: + print(f"[Resources查找] 文件不存在: {potential_path}") if fixed: print(f"路径修复: {original_filepath} -> {filepath}")