using XGame.Editor.Asset;
using UnityEditor;
using UnityEngine;

namespace XGame.Editor.Build.AssetBundles
{
    public partial class ABPackerInfoManifest
    {
        public static ABPackerInfoManifest Load()
        {
            return AssetDatabase.LoadAssetAtPath<ABPackerInfoManifest>(PathDefine.ABPackerManifestPath);
        }

        internal static void LoadOrCreate()
        {
            var manifest = Load();

            if (manifest == null)
            {
                manifest = ScriptableObject.CreateInstance<ABPackerInfoManifest>();
                AssetDatabase.CreateAsset(manifest, PathDefine.ABPackerManifestPath);
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
            }
        }
    }
}
