From 122c4f397551c4596b2eed2cea0fac409afa13ca Mon Sep 17 00:00:00 2001 From: desktop-maesty/steve Date: Sun, 25 Mar 2018 11:54:25 +1000 Subject: [PATCH] More thorough checking that the Fungus EditorResource folder is infact the Fungus EditorResource folder --- .../Scripts/Editor/FungusEditorResources.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Assets/Fungus/Scripts/Editor/FungusEditorResources.cs b/Assets/Fungus/Scripts/Editor/FungusEditorResources.cs index 411fab08..b3ebd715 100644 --- a/Assets/Fungus/Scripts/Editor/FungusEditorResources.cs +++ b/Assets/Fungus/Scripts/Editor/FungusEditorResources.cs @@ -78,6 +78,7 @@ namespace Fungus.EditorUtils private static FungusEditorResources instance; private static readonly string editorResourcesFolderName = "\"EditorResources\""; + private static readonly string PartialEditorResourcesPath = System.IO.Path.Combine("Fungus\\", "EditorResources"); [SerializeField] [HideInInspector] private bool updateOnReloadScripts = false; internal static FungusEditorResources Instance @@ -97,7 +98,7 @@ namespace Fungus.EditorUtils { if (guids.Length > 1) { - Debug.LogWarning("Multiple FungusEditorResources assets found!"); + Debug.LogError("Multiple FungusEditorResources assets found!"); } var path = AssetDatabase.GUIDToAssetPath(guids[0]); @@ -111,8 +112,17 @@ namespace Fungus.EditorUtils private static string GetRootFolder() { - var rootGuid = AssetDatabase.FindAssets(editorResourcesFolderName)[0]; - return AssetDatabase.GUIDToAssetPath(rootGuid); + var res = AssetDatabase.FindAssets(editorResourcesFolderName); + + foreach (var item in res) + { + var path = AssetDatabase.GUIDToAssetPath(item); + var safePath = System.IO.Path.GetFullPath(path); + if (safePath.IndexOf(PartialEditorResourcesPath) != -1) + return path; + } + + return string.Empty; } internal static void GenerateResourcesScript()