Browse Source

Merge pull request #664 from stevehalliwell/EditorResourceChecks

More thorough checking that the Fungus EditorResource folder is infac…
master
Steve Halliwell 7 years ago committed by GitHub
parent
commit
3730855f15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      Assets/Fungus/Scripts/Editor/FungusEditorResources.cs

16
Assets/Fungus/Scripts/Editor/FungusEditorResources.cs

@ -78,6 +78,7 @@ namespace Fungus.EditorUtils
private static FungusEditorResources instance; private static FungusEditorResources instance;
private static readonly string editorResourcesFolderName = "\"EditorResources\""; private static readonly string editorResourcesFolderName = "\"EditorResources\"";
private static readonly string PartialEditorResourcesPath = System.IO.Path.Combine("Fungus\\", "EditorResources");
[SerializeField] [HideInInspector] private bool updateOnReloadScripts = false; [SerializeField] [HideInInspector] private bool updateOnReloadScripts = false;
internal static FungusEditorResources Instance internal static FungusEditorResources Instance
@ -97,7 +98,7 @@ namespace Fungus.EditorUtils
{ {
if (guids.Length > 1) if (guids.Length > 1)
{ {
Debug.LogWarning("Multiple FungusEditorResources assets found!"); Debug.LogError("Multiple FungusEditorResources assets found!");
} }
var path = AssetDatabase.GUIDToAssetPath(guids[0]); var path = AssetDatabase.GUIDToAssetPath(guids[0]);
@ -111,8 +112,17 @@ namespace Fungus.EditorUtils
private static string GetRootFolder() private static string GetRootFolder()
{ {
var rootGuid = AssetDatabase.FindAssets(editorResourcesFolderName)[0]; var res = AssetDatabase.FindAssets(editorResourcesFolderName);
return AssetDatabase.GUIDToAssetPath(rootGuid);
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() internal static void GenerateResourcesScript()

Loading…
Cancel
Save