From f6a915c2b35960c2f69edbc90565930e4221e8f4 Mon Sep 17 00:00:00 2001
From: bd_ <bdunderscore@fushizen.net>
Date: Sat, 17 Sep 2022 09:58:47 -0700
Subject: [PATCH] Support referencing the basePath object in relative mode
 (#21)

---
 .../net.fushizen.modular-avatar/Editor/AnimatorMerger.cs  | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/Packages/net.fushizen.modular-avatar/Editor/AnimatorMerger.cs b/Packages/net.fushizen.modular-avatar/Editor/AnimatorMerger.cs
index f3f3488a..e51bd09c 100644
--- a/Packages/net.fushizen.modular-avatar/Editor/AnimatorMerger.cs
+++ b/Packages/net.fushizen.modular-avatar/Editor/AnimatorMerger.cs
@@ -125,7 +125,13 @@ namespace net.fushizen.modular_avatar.core.editor
             }
             else
             {
-                return PathMappings.MapPath(basePath + binding.path, binding.type == typeof(Transform));
+                var newPath = binding.path == "" ? basePath : basePath + binding.path;
+                if (newPath.EndsWith("/"))
+                {
+                    newPath = newPath.Substring(0, newPath.Length - 1);
+                }
+
+                return PathMappings.MapPath(newPath, binding.type == typeof(Transform));
             }
         }