From 89e196208d89007a7b033b0e70488035ae61eb73 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期五, 22 五月 2026 11:48:53 +0800
Subject: [PATCH] 改动2

---
 Assets/Editor/YooAsset/AddressByRelativePath.cs |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/Assets/Editor/YooAsset/AddressByRelativePath.cs b/Assets/Editor/YooAsset/AddressByRelativePath.cs
index 0f0a056..f212437 100644
--- a/Assets/Editor/YooAsset/AddressByRelativePath.cs
+++ b/Assets/Editor/YooAsset/AddressByRelativePath.cs
@@ -4,6 +4,7 @@
 // 閬垮厤鍚岀洰褰曚笅鍚屽悕涓嶅悓鎵╁睍鍚嶆枃浠剁殑鍦板潃鍐茬獊
 // ============================================================================
 
+using System;
 using System.IO;
 using YooAsset.Editor;
 
@@ -20,20 +21,23 @@
 {
     string IAddressRule.GetAssetAddress(AddressRuleData data)
     {
-        // 鍘绘帀 CollectPath 鍓嶇紑锛屽緱鍒扮浉瀵硅矾寰�
-        string relativePath = data.AssetPath;
-        string collectRoot = data.CollectPath;
+        string assetPath = NormalizeAssetPath(data.AssetPath);
+        string collectPath = NormalizeAssetPath(data.CollectPath).TrimEnd('/');
 
-        // 纭繚浠� / 缁撳熬
-        if (!collectRoot.EndsWith("/"))
-            collectRoot += "/";
+        if (assetPath.Equals(collectPath, StringComparison.OrdinalIgnoreCase))
+            return Path.GetFileName(assetPath);
 
-        if (relativePath.StartsWith(collectRoot))
+        string collectRoot = collectPath + "/";
+        if (assetPath.StartsWith(collectRoot, StringComparison.OrdinalIgnoreCase))
         {
-            relativePath = relativePath.Substring(collectRoot.Length);
+            return assetPath.Substring(collectRoot.Length);
         }
 
-        // 淇濈暀鎵╁睍鍚嶏紝閬垮厤鍚屽悕涓嶅悓绫诲瀷鏂囦欢鍦板潃鍐茬獊
-        return relativePath;
+        return Path.GetFileName(assetPath);
+    }
+
+    private static string NormalizeAssetPath(string assetPath)
+    {
+        return string.IsNullOrEmpty(assetPath) ? string.Empty : assetPath.Replace('\\', '/');
     }
 }

--
Gitblit v1.8.0