diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderHelper.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderHelper.cs index 142d2dc..bbc9969 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderHelper.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderHelper.cs @@ -17,6 +17,14 @@ namespace YooAsset.Editor return $"{projectPath}/Bundles"; } + /// + /// 获取流文件夹路径 + /// + public static string GetStreamingAssetsFolderPath() + { + return $"{Application.dataPath}/StreamingAssets/YooAssets/"; + } + /// /// 获取构建管线的输出目录 /// @@ -30,8 +38,8 @@ namespace YooAsset.Editor /// public static void ClearStreamingAssetsFolder() { - string streamingPath = Application.dataPath + "/StreamingAssets"; - EditorTools.ClearFolder(streamingPath); + string streamingFolderPath = GetStreamingAssetsFolderPath(); + EditorTools.ClearFolder(streamingFolderPath); } /// @@ -40,17 +48,17 @@ namespace YooAsset.Editor /// public static void DeleteStreamingAssetsIgnoreFiles() { - string streamingPath = Application.dataPath + "/StreamingAssets"; - if (Directory.Exists(streamingPath)) + string streamingFolderPath = GetStreamingAssetsFolderPath(); + 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) { FileInfo info = new FileInfo(file); info.Delete(); } - files = Directory.GetFiles(streamingPath, "*.meta", SearchOption.AllDirectories); + files = Directory.GetFiles(streamingFolderPath, "*.meta", SearchOption.AllDirectories); foreach (var item in files) { FileInfo info = new FileInfo(item); diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCopyBuildinFiles.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCopyBuildinFiles.cs index 77810fc..bd26edb 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCopyBuildinFiles.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCopyBuildinFiles.cs @@ -38,7 +38,7 @@ namespace YooAsset.Editor continue; string sourcePath = $"{pipelineOutputDirectory}/{patchBundle.BundleName}"; - string destPath = $"{Application.dataPath}/StreamingAssets/{patchBundle.Hash}"; + string destPath = $"{AssetBundleBuilderHelper.GetStreamingAssetsFolderPath()}/{patchBundle.Hash}"; Debug.Log($"拷贝内置文件到流目录:{patchBundle.BundleName}"); EditorTools.CopyFile(sourcePath, destPath, true); } @@ -46,14 +46,14 @@ namespace YooAsset.Editor // 拷贝清单文件 { 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); } // 拷贝清单哈希文件 { 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); } diff --git a/Assets/YooAsset/Runtime/Utility/YooHelper.cs b/Assets/YooAsset/Runtime/Utility/YooHelper.cs index 1418362..f84a824 100644 --- a/Assets/YooAsset/Runtime/Utility/YooHelper.cs +++ b/Assets/YooAsset/Runtime/Utility/YooHelper.cs @@ -30,7 +30,7 @@ namespace YooAsset /// 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); } ///