refactor : process build logic

pull/342/head
hevinci 2024-08-03 19:01:55 +08:00
parent f86ea04521
commit b7b375092f
1 changed files with 5 additions and 6 deletions

View File

@ -15,6 +15,8 @@ namespace YooAsset
/// </summary> /// </summary>
public void OnPreprocessBuild(UnityEditor.Build.Reporting.BuildReport report) public void OnPreprocessBuild(UnityEditor.Build.Reporting.BuildReport report)
{ {
YooLogger.Log("Begin to create catalog file !");
string savePath = $"Assets/Resources/{YooAssetSettingsData.Setting.DefaultYooFolderName}"; string savePath = $"Assets/Resources/{YooAssetSettingsData.Setting.DefaultYooFolderName}";
DirectoryInfo saveDirectory = new DirectoryInfo(savePath); DirectoryInfo saveDirectory = new DirectoryInfo(savePath);
if (saveDirectory.Exists) if (saveDirectory.Exists)
@ -24,8 +26,7 @@ namespace YooAsset
DirectoryInfo rootDirectory = new DirectoryInfo(rootPath); DirectoryInfo rootDirectory = new DirectoryInfo(rootPath);
if (rootDirectory.Exists == false) if (rootDirectory.Exists == false)
{ {
Debug.LogWarning($"Can not found StreamingAssets root directory : {rootPath}"); throw new System.Exception($"Can not found StreamingAssets root directory : {rootPath}");
return;
} }
// 搜索所有Package目录 // 搜索所有Package目录
@ -48,8 +49,7 @@ namespace YooAsset
string versionFilePath = $"{pacakgeDirectory}/{versionFileName}"; string versionFilePath = $"{pacakgeDirectory}/{versionFileName}";
if (File.Exists(versionFilePath) == false) if (File.Exists(versionFilePath) == false)
{ {
Debug.LogWarning($"Can not found package version file : {versionFilePath}"); throw new System.Exception($"Can not found package version file : {versionFilePath}");
return;
} }
packageVersion = FileUtility.ReadAllText(versionFilePath); packageVersion = FileUtility.ReadAllText(versionFilePath);
@ -62,8 +62,7 @@ namespace YooAsset
string manifestFilePath = $"{pacakgeDirectory}/{manifestFileName}"; string manifestFilePath = $"{pacakgeDirectory}/{manifestFileName}";
if (File.Exists(manifestFilePath) == false) if (File.Exists(manifestFilePath) == false)
{ {
Debug.LogWarning($"Can not found package manifest file : {manifestFilePath}"); throw new System.Exception($"Can not found package manifest file : {manifestFilePath}");
return;
} }
var binaryData = FileUtility.ReadAllBytes(manifestFilePath); var binaryData = FileUtility.ReadAllBytes(manifestFilePath);