Skip to content

Commit eef4261

Browse files
committed
Fix: NormalizePath now handles backslashes correctly using AssetPathUtility
1 parent 784ecd4 commit eef4261

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

MCPForUnity/Editor/Tools/ManageMaterial.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,16 @@ public static object HandleCommand(JObject @params)
5757
private static string NormalizePath(string path)
5858
{
5959
if (string.IsNullOrEmpty(path)) return path;
60-
if (!path.StartsWith("Assets/")) path = "Assets/" + path;
61-
if (!path.EndsWith(".mat", StringComparison.OrdinalIgnoreCase)) path += ".mat";
60+
61+
// Normalize separators and ensure Assets/ root
62+
path = AssetPathUtility.SanitizeAssetPath(path);
63+
64+
// Ensure .mat extension
65+
if (!path.EndsWith(".mat", StringComparison.OrdinalIgnoreCase))
66+
{
67+
path += ".mat";
68+
}
69+
6270
return path;
6371
}
6472

0 commit comments

Comments
 (0)