CmdBuildPostProcessor.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using XGame.Editor.Asset;
  2. using System;
  3. namespace XGame.Editor.Build
  4. {
  5. [BuildCommand((uint)BuildCommandPriority.BuildPostProcessor)]
  6. class CmdBuildPostProcessor : BaseBuildCommand, ICommandExecuter
  7. {
  8. public BuildErrorCode Execute()
  9. {
  10. try
  11. {
  12. var abOutputPathPath = PathDefine.AssetBundleOutputPath;
  13. if (System.IO.Directory.Exists(abOutputPathPath))
  14. {
  15. // 把ab输出目录也删了
  16. UnityEditor.FileUtil.DeleteFileOrDirectory(abOutputPathPath);
  17. }
  18. //打包完删除streamingAssetsPath
  19. if (System.IO.Directory.Exists(UnityEngine.Application.streamingAssetsPath))
  20. {
  21. UnityEditor.FileUtil.DeleteFileOrDirectory(UnityEngine.Application.streamingAssetsPath);
  22. UnityEditor.AssetDatabase.Refresh();
  23. }
  24. if (!Context.config.project.isSaveSpriteAtlas)
  25. {
  26. (new Asset.Tools.SpriteAtlasClearTask()).Run();
  27. }
  28. }
  29. catch (Exception ex)
  30. {
  31. BuildLog.Exception(ex);
  32. }
  33. BuildLog.Log("CmdBuildPostProcessor Finish.");
  34. return BuildErrorCode.CmdCompleted;
  35. }
  36. }
  37. }