TapLogin-Unity/Editor/TapLoginIOSProcessor.cs

40 lines
1.3 KiB
C#
Raw Normal View History

using System.IO;
using TapTap.Common.Editor;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEngine;
namespace TapTap.Login.Editor
{
public static class TapLoginIOSProcessor
{
// 添加标签unity导出工程后自动执行该函数
[PostProcessBuild(103)]
public static void OnPostprocessBuild(BuildTarget buildTarget, string path)
{
if (buildTarget != BuildTarget.iOS) return;
// 获得工程路径
var projPath = TapCommonCompile.GetProjPath(path);
var proj = TapCommonCompile.ParseProjPath(projPath);
var target = TapCommonCompile.GetUnityTarget(proj);
if (TapCommonCompile.CheckTarget(target))
{
Debug.LogError("Unity-iPhone is NUll");
return;
}
var parentFolder = Directory.GetParent(Application.dataPath)?.FullName;
var plistFile = TapFileHelper.RecursionFilterFile(parentFolder + "/Assets/Plugins/", "TDS-Info.plist");
if (!plistFile.Exists)
{
Debug.LogError("TapSDK Can't find TDS-Info.plist in Project/Assets/Plugins/!");
}
TapCommonCompile.HandlerPlist(path, plistFile.FullName);
}
}
}