diff --git a/Assets/YooAsset/Runtime/FileSystem/CacheSystem/CacheHelper.cs b/Assets/YooAsset/Runtime/FileSystem/CacheSystem/CacheHelper.cs
new file mode 100644
index 0000000..d984476
--- /dev/null
+++ b/Assets/YooAsset/Runtime/FileSystem/CacheSystem/CacheHelper.cs
@@ -0,0 +1,25 @@
+using System;
+using System.IO;
+
+namespace YooAsset
+{
+ internal class CacheHelper
+ {
+ ///
+ /// 获取默认的缓存根目录
+ ///
+ public static string GetDefaultCacheRoot()
+ {
+#if UNITY_EDITOR
+ // 注意:为了方便调试查看,编辑器下把存储目录放到项目里。
+ string projectPath = Path.GetDirectoryName(UnityEngine.Application.dataPath);
+ projectPath = PathUtility.RegularPath(projectPath);
+ return PathUtility.Combine(projectPath, YooAssetSettingsData.Setting.DefaultYooFolderName);
+#elif UNITY_STANDALONE
+ return PathUtility.Combine(UnityEngine.Application.dataPath, YooAssetSettingsData.Setting.DefaultYooFolderName);
+#else
+ return PathUtility.Combine(UnityEngine.Application.persistentDataPath, YooAssetSettingsData.Setting.DefaultYooFolderName);
+#endif
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/FileSystem/FileSystemHelper.cs.meta b/Assets/YooAsset/Runtime/FileSystem/CacheSystem/CacheHelper.cs.meta
similarity index 100%
rename from Assets/YooAsset/Runtime/FileSystem/FileSystemHelper.cs.meta
rename to Assets/YooAsset/Runtime/FileSystem/CacheSystem/CacheHelper.cs.meta
diff --git a/Assets/YooAsset/Runtime/FileSystem/FileSystemHelper.cs b/Assets/YooAsset/Runtime/FileSystem/CacheSystem/FileVerifyHelper.cs
similarity index 97%
rename from Assets/YooAsset/Runtime/FileSystem/FileSystemHelper.cs
rename to Assets/YooAsset/Runtime/FileSystem/CacheSystem/FileVerifyHelper.cs
index b2f606b..bbfe2b9 100644
--- a/Assets/YooAsset/Runtime/FileSystem/FileSystemHelper.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/CacheSystem/FileVerifyHelper.cs
@@ -3,7 +3,7 @@ using System.IO;
namespace YooAsset
{
- internal class FileSystemHelper
+ internal class FileVerifyHelper
{
///
/// 文件校验
diff --git a/Assets/YooAsset/Runtime/FileSystem/CacheSystem/FileVerifyHelper.cs.meta b/Assets/YooAsset/Runtime/FileSystem/CacheSystem/FileVerifyHelper.cs.meta
new file mode 100644
index 0000000..8f8bbb0
--- /dev/null
+++ b/Assets/YooAsset/Runtime/FileSystem/CacheSystem/FileVerifyHelper.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: db3336ad3b5a8f349a3144e77f23fcf8
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/YooAsset/Runtime/FileSystem/CacheSystem/Operation/VerifyCacheFilesOperation.cs b/Assets/YooAsset/Runtime/FileSystem/CacheSystem/Operation/VerifyCacheFilesOperation.cs
index 53d2761..b2496ff 100644
--- a/Assets/YooAsset/Runtime/FileSystem/CacheSystem/Operation/VerifyCacheFilesOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/CacheSystem/Operation/VerifyCacheFilesOperation.cs
@@ -165,7 +165,7 @@ namespace YooAsset
return EFileVerifyResult.Exception;
}
- return FileSystemHelper.FileVerify(element.DataFilePath, element.DataFileSize, element.DataFileCRC, verifyLevel);
+ return FileVerifyHelper.FileVerify(element.DataFilePath, element.DataFileSize, element.DataFileCRC, verifyLevel);
}
}
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/FileSystem/CacheSystem/Operation/VerifyTempFileOperation.cs b/Assets/YooAsset/Runtime/FileSystem/CacheSystem/Operation/VerifyTempFileOperation.cs
index f246e00..271cdaa 100644
--- a/Assets/YooAsset/Runtime/FileSystem/CacheSystem/Operation/VerifyTempFileOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/CacheSystem/Operation/VerifyTempFileOperation.cs
@@ -84,7 +84,7 @@ namespace YooAsset
private void VerifyInThread(object obj)
{
TempFileElement element = (TempFileElement)obj;
- int result = (int)FileSystemHelper.FileVerify(element.TempFilePath, element.TempFileSize, element.TempFileCRC, EFileVerifyLevel.High);
+ int result = (int)FileVerifyHelper.FileVerify(element.TempFilePath, element.TempFileSize, element.TempFileCRC, EFileVerifyLevel.High);
element.Result = result;
}
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/DefaultCacheFileSystem.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/DefaultCacheFileSystem.cs
index eee98e2..b719952 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/DefaultCacheFileSystem.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/DefaultCacheFileSystem.cs
@@ -20,7 +20,7 @@ namespace YooAsset
protected readonly Dictionary _tempFilePaths = new Dictionary(10000);
protected readonly List _removeList = new List(1000);
protected string _packageRoot;
- protected string _saveFileRoot;
+ protected string _cacheFileRoot;
protected string _tempFileRoot;
protected string _manifestFileRoot;
@@ -238,10 +238,10 @@ namespace YooAsset
PackageName = packageName;
if (string.IsNullOrEmpty(rootDirectory))
- rootDirectory = GetDefaultRoot();
+ rootDirectory = CacheHelper.GetDefaultCacheRoot();
_packageRoot = PathUtility.Combine(rootDirectory, packageName);
- _saveFileRoot = PathUtility.Combine(_packageRoot, DefaultCacheFileSystemDefine.SaveFilesFolderName);
+ _cacheFileRoot = PathUtility.Combine(_packageRoot, DefaultCacheFileSystemDefine.SaveFilesFolderName);
_tempFileRoot = PathUtility.Combine(_packageRoot, DefaultCacheFileSystemDefine.TempFilesFolderName);
_manifestFileRoot = PathUtility.Combine(_packageRoot, DefaultCacheFileSystemDefine.ManifestFilesFolderName);
}
@@ -359,7 +359,7 @@ namespace YooAsset
#region 缓存系统
public string GetCacheFileRoot()
{
- return _saveFileRoot;
+ return _cacheFileRoot;
}
public List GetAllCachedBundleGUIDs()
{
@@ -387,7 +387,7 @@ namespace YooAsset
if (_wrappers.TryGetValue(bundle.BundleGUID, out CacheWrapper wrapper) == false)
return EFileVerifyResult.CacheNotFound;
- EFileVerifyResult result = FileSystemHelper.FileVerify(wrapper.DataFilePath, wrapper.DataFileSize, wrapper.DataFileCRC, EFileVerifyLevel.High);
+ EFileVerifyResult result = FileVerifyHelper.FileVerify(wrapper.DataFilePath, wrapper.DataFileSize, wrapper.DataFileCRC, EFileVerifyLevel.High);
return result;
}
public bool WriteCacheFile(PackageBundle bundle, string copyPath)
@@ -472,25 +472,12 @@ namespace YooAsset
#endregion
#region 内部方法
- protected string GetDefaultRoot()
- {
-#if UNITY_EDITOR
- // 注意:为了方便调试查看,编辑器下把存储目录放到项目里。
- string projectPath = Path.GetDirectoryName(UnityEngine.Application.dataPath);
- projectPath = PathUtility.RegularPath(projectPath);
- return PathUtility.Combine(projectPath, YooAssetSettingsData.Setting.DefaultYooFolderName);
-#elif UNITY_STANDALONE
- return PathUtility.Combine(UnityEngine.Application.dataPath, YooAssetSettingsData.Setting.DefaultYooFolderName);
-#else
- return PathUtility.Combine(UnityEngine.Application.persistentDataPath, YooAssetSettingsData.Setting.DefaultYooFolderName);
-#endif
- }
protected string GetDataFilePath(PackageBundle bundle)
{
if (_dataFilePaths.TryGetValue(bundle.BundleGUID, out string filePath) == false)
{
string folderName = bundle.FileHash.Substring(0, 2);
- filePath = PathUtility.Combine(_saveFileRoot, folderName, bundle.BundleGUID, DefaultCacheFileSystemDefine.SaveBundleDataFileName);
+ filePath = PathUtility.Combine(_cacheFileRoot, folderName, bundle.BundleGUID, DefaultCacheFileSystemDefine.SaveBundleDataFileName);
if (AppendFileExtension)
filePath += bundle.FileExtension;
_dataFilePaths.Add(bundle.BundleGUID, filePath);
@@ -502,7 +489,7 @@ namespace YooAsset
if (_infoFilePaths.TryGetValue(bundle.BundleGUID, out string filePath) == false)
{
string folderName = bundle.FileHash.Substring(0, 2);
- filePath = PathUtility.Combine(_saveFileRoot, folderName, bundle.BundleGUID, DefaultCacheFileSystemDefine.SaveBundleInfoFileName);
+ filePath = PathUtility.Combine(_cacheFileRoot, folderName, bundle.BundleGUID, DefaultCacheFileSystemDefine.SaveBundleInfoFileName);
_infoFilePaths.Add(bundle.BundleGUID, filePath);
}
return filePath;