using System;
using System.IO;
using UnityEditor;
using UnityEngine;
using XNode;
using Object = UnityEngine.Object;
namespace XNodeEditor
{
/// Deals with modified assets
internal class NodeEditorAssetModProcessor : AssetModificationProcessor
{
///
/// Automatically delete Node sub-assets before deleting their script.
/// This is important to do, because you can't delete null sub assets.
///
/// For another workaround, see: https://gitlab.com/RotaryHeart-UnityShare/subassetmissingscriptdelete
///
private static AssetDeleteResult OnWillDeleteAsset(string path, RemoveAssetOptions options)
{
// Skip processing anything without the .cs extension
if (Path.GetExtension(path) != ".cs")
{
return AssetDeleteResult.DidNotDelete;
}
// Get the object that is requested for deletion
Object obj = AssetDatabase.LoadAssetAtPath