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}")