Update AssetBundleTools

StreamingAssets目录下增加了用于存放打包资源的总文件夹
pull/4/head
hevinci 2022-04-07 19:18:33 +08:00
parent b7a20d4bdb
commit d6b54dd49c
3 changed files with 18 additions and 10 deletions

View File

@ -17,6 +17,14 @@ namespace YooAsset.Editor
return $"{projectPath}/Bundles"; return $"{projectPath}/Bundles";
} }
/// <summary>
/// 获取流文件夹路径
/// </summary>
public static string GetStreamingAssetsFolderPath()
{
return $"{Application.dataPath}/StreamingAssets/YooAssets/";
}
/// <summary> /// <summary>
/// 获取构建管线的输出目录 /// 获取构建管线的输出目录
/// </summary> /// </summary>
@ -30,8 +38,8 @@ namespace YooAsset.Editor
/// </summary> /// </summary>
public static void ClearStreamingAssetsFolder() public static void ClearStreamingAssetsFolder()
{ {
string streamingPath = Application.dataPath + "/StreamingAssets"; string streamingFolderPath = GetStreamingAssetsFolderPath();
EditorTools.ClearFolder(streamingPath); EditorTools.ClearFolder(streamingFolderPath);
} }
/// <summary> /// <summary>
@ -40,17 +48,17 @@ namespace YooAsset.Editor
/// </summary> /// </summary>
public static void DeleteStreamingAssetsIgnoreFiles() public static void DeleteStreamingAssetsIgnoreFiles()
{ {
string streamingPath = Application.dataPath + "/StreamingAssets"; string streamingFolderPath = GetStreamingAssetsFolderPath();
if (Directory.Exists(streamingPath)) if (Directory.Exists(streamingFolderPath))
{ {
string[] files = Directory.GetFiles(streamingPath, "*.manifest", SearchOption.AllDirectories); string[] files = Directory.GetFiles(streamingFolderPath, "*.manifest", SearchOption.AllDirectories);
foreach (var file in files) foreach (var file in files)
{ {
FileInfo info = new FileInfo(file); FileInfo info = new FileInfo(file);
info.Delete(); info.Delete();
} }
files = Directory.GetFiles(streamingPath, "*.meta", SearchOption.AllDirectories); files = Directory.GetFiles(streamingFolderPath, "*.meta", SearchOption.AllDirectories);
foreach (var item in files) foreach (var item in files)
{ {
FileInfo info = new FileInfo(item); FileInfo info = new FileInfo(item);

View File

@ -38,7 +38,7 @@ namespace YooAsset.Editor
continue; continue;
string sourcePath = $"{pipelineOutputDirectory}/{patchBundle.BundleName}"; string sourcePath = $"{pipelineOutputDirectory}/{patchBundle.BundleName}";
string destPath = $"{Application.dataPath}/StreamingAssets/{patchBundle.Hash}"; string destPath = $"{AssetBundleBuilderHelper.GetStreamingAssetsFolderPath()}/{patchBundle.Hash}";
Debug.Log($"拷贝内置文件到流目录:{patchBundle.BundleName}"); Debug.Log($"拷贝内置文件到流目录:{patchBundle.BundleName}");
EditorTools.CopyFile(sourcePath, destPath, true); EditorTools.CopyFile(sourcePath, destPath, true);
} }
@ -46,14 +46,14 @@ namespace YooAsset.Editor
// 拷贝清单文件 // 拷贝清单文件
{ {
string sourcePath = $"{pipelineOutputDirectory}/{YooAssetSettingsData.Setting.PatchManifestFileName}"; string sourcePath = $"{pipelineOutputDirectory}/{YooAssetSettingsData.Setting.PatchManifestFileName}";
string destPath = $"{Application.dataPath}/StreamingAssets/{YooAssetSettingsData.Setting.PatchManifestFileName}"; string destPath = $"{AssetBundleBuilderHelper.GetStreamingAssetsFolderPath()}/{YooAssetSettingsData.Setting.PatchManifestFileName}";
EditorTools.CopyFile(sourcePath, destPath, true); EditorTools.CopyFile(sourcePath, destPath, true);
} }
// 拷贝清单哈希文件 // 拷贝清单哈希文件
{ {
string sourcePath = $"{pipelineOutputDirectory}/{YooAssetSettingsData.Setting.PatchManifestHashFileName}"; string sourcePath = $"{pipelineOutputDirectory}/{YooAssetSettingsData.Setting.PatchManifestHashFileName}";
string destPath = $"{Application.dataPath}/StreamingAssets/{YooAssetSettingsData.Setting.PatchManifestHashFileName}"; string destPath = $"{AssetBundleBuilderHelper.GetStreamingAssetsFolderPath()}/{YooAssetSettingsData.Setting.PatchManifestHashFileName}";
EditorTools.CopyFile(sourcePath, destPath, true); EditorTools.CopyFile(sourcePath, destPath, true);
} }

View File

@ -30,7 +30,7 @@ namespace YooAsset
/// </summary> /// </summary>
public static string MakeStreamingLoadPath(string path) public static string MakeStreamingLoadPath(string path)
{ {
return StringUtility.Format("{0}/{1}", UnityEngine.Application.streamingAssetsPath, path); return StringUtility.Format("{0}/YooAssets/{1}", UnityEngine.Application.streamingAssetsPath, path);
} }
/// <summary> /// <summary>