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