diff --git a/src/MDriveSync.Core/Services/AliyunJob.cs b/src/MDriveSync.Core/Services/AliyunJob.cs
index 02ab7fc..2c64f05 100644
--- a/src/MDriveSync.Core/Services/AliyunJob.cs
+++ b/src/MDriveSync.Core/Services/AliyunJob.cs
@@ -1641,7 +1641,7 @@ private void ClearDownloadCache(string saveRootPath)
private string GetDirectoryKey(string localRootPath, DirectoryInfo directoryInfo)
{
var localRootInfo = new DirectoryInfo(localRootPath);
- var subPath = directoryInfo.FullName.TrimPrefix(localRootInfo.FullName);
+ var subPath = directoryInfo.FullName.TrimPath().TrimPrefix(localRootInfo.FullName.TrimPath());
return $"{localRootInfo.Name}/{subPath}".TrimPath();
}
@@ -1654,7 +1654,7 @@ private string GetDirectoryKey(string localRootPath, DirectoryInfo directoryInfo
private string GetFileKey(string localRootPath, string fileFullPath)
{
var localRootInfo = new DirectoryInfo(localRootPath);
- var subPath = fileFullPath.TrimPrefix(localRootInfo.FullName);
+ var subPath = fileFullPath.TrimPath().TrimPrefix(localRootInfo.FullName.TrimPath());
return $"{localRootInfo.Name}/{subPath}".TrimPath();
}
@@ -1667,10 +1667,7 @@ private string GetFileKey(string localRootPath, string fileFullPath)
private string GetFileKeyPath(string localRootPath, FileInfo fileInfo)
{
var localRootInfo = new DirectoryInfo(localRootPath);
-
- // fix: GetDirectoryName none / end
- var subPath = Path.GetDirectoryName(fileInfo.FullName).TrimPath()
- .TrimPrefix(localRootInfo.FullName.TrimPath());
+ var subPath = Path.GetDirectoryName(fileInfo.FullName).TrimPath().TrimPrefix(localRootInfo.FullName.TrimPath());
return $"{localRootInfo.Name}/{subPath}".TrimPath();
}
diff --git a/src/MDriveSync.Core/Services/LocalStorageJob.cs b/src/MDriveSync.Core/Services/LocalStorageJob.cs
index 6a3e854..4782dec 100644
--- a/src/MDriveSync.Core/Services/LocalStorageJob.cs
+++ b/src/MDriveSync.Core/Services/LocalStorageJob.cs
@@ -1427,28 +1427,6 @@ private int GetDownloadThreadCount()
return processorCount;
}
- ///
- /// 清理下载缓存
- ///
- private void ClearDownloadCache(string saveRootPath)
- {
- // 清理临时文件
- var tempPath = Path.Combine(saveRootPath, ".duplicaticache");
- if (Directory.Exists(tempPath))
- {
- Directory.Delete(tempPath, true);
- }
-
- var tmpFiles = Directory.GetFiles(saveRootPath, "*.duplicatidownload", SearchOption.AllDirectories);
- foreach (var file in tmpFiles)
- {
- if (File.Exists(file))
- {
- File.Delete(file);
- }
- }
- }
-
///
/// 获取文件夹路径 key
/// 将本地路径转为 {备份根目录}/{子目录}
@@ -1461,8 +1439,8 @@ private string GetDirectoryKey(string rootDirFullPath, DirectoryInfo directoryIn
var baseDirInfo = new DirectoryInfo(rootDirFullPath);
var baseDirName = baseDirInfo.Name;
- var subPath = directoryInfo.FullName.TrimPrefix(rootDirFullPath);
- return $"{baseDirName}/{subPath.TrimPath()}";
+ var subPath = directoryInfo.FullName.TrimPath().TrimPrefix(rootDirFullPath.TrimPath());
+ return $"{baseDirName}/{subPath.TrimPath()}".TrimPath();
}
///
@@ -1476,23 +1454,8 @@ private string GetFileKey(string rootPath, string fileFullPath)
var rootInfo = new DirectoryInfo(rootPath);
var rootPathName = rootInfo.Name;
- var subPath = fileFullPath.TrimPrefix(rootInfo.FullName);
- return $"{rootPathName}/{subPath.TrimPath()}";
- }
-
- ///
- /// 获取文件路径 key
- ///
- ///
- ///
- ///
- private string GetFileKeyPath(string rootPath, FileInfo fileInfo)
- {
- var rootInfo = new DirectoryInfo(rootPath);
- var rootName = rootInfo.Name;
-
- var subPath = Path.GetDirectoryName(fileInfo.FullName).TrimPrefix(rootInfo.FullName);
- return $"{rootName}/{subPath.TrimPath()}";
+ var subPath = fileFullPath.TrimPath().TrimPrefix(rootInfo.FullName.TrimPath());
+ return $"{rootPathName}/{subPath.TrimPath()}".TrimPath();
}
///