Skip to content

Commit

Permalink
fix: linux path bug
Browse files Browse the repository at this point in the history
  • Loading branch information
trueai-org committed Jun 18, 2024
1 parent ea0b969 commit da9f149
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/MDriveSync.Core/Services/AliyunJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1872,7 +1872,7 @@ private void AliyunDriveInitialize()
_driveSavePath = _jobConfig.Target.TrimPrefix();

// 格式化备份目录
var sources = _jobConfig.Sources.Where(c => !string.IsNullOrWhiteSpace(c)).Select(c => c.TrimPath()).Distinct().ToList();
var sources = _jobConfig.Sources.Where(c => !string.IsNullOrWhiteSpace(c)).Distinct().ToList();
_jobConfig.Sources.Clear();
foreach (var item in sources)
{
Expand All @@ -1883,7 +1883,7 @@ private void AliyunDriveInitialize()
{
dir.Create();
}
_jobConfig.Sources.Add($"{dir.FullName.TrimPath()}");
_jobConfig.Sources.Add(dir.FullName);
}
else
{
Expand Down
10 changes: 5 additions & 5 deletions src/MDriveSync.Core/Services/LocalStorageJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ private void SyncFiles(CancellationToken token)
{
var saveParentPath = $"{_targetSaveRootPath}/{item.Key.TrimPath()}";
var dirInfo = new DirectoryInfo(saveParentPath);
if(!dirInfo.Exists)
if (!dirInfo.Exists)
{
dirInfo.Create();
}
Expand Down Expand Up @@ -1706,7 +1706,7 @@ private void Initialize()
_log.LogInformation($"Linux: {isLinux}");

// 处理 RestoreRootPath
if (IsLinux() && (_jobConfig.Restore?.StartsWith("/") ?? false))
if (isLinux && (_jobConfig.Restore?.StartsWith("/") ?? false))
{
_tartgetRestoreRootPath = "/" + _jobConfig.Restore.TrimPath();
}
Expand All @@ -1716,7 +1716,7 @@ private void Initialize()
}

// 处理 TargetRootPath
if (IsLinux() && (_jobConfig.Target?.StartsWith("/") ?? false))
if (isLinux && (_jobConfig.Target?.StartsWith("/") ?? false))
{
_targetSaveRootPath = "/" + _jobConfig.Target.TrimPath();
}
Expand All @@ -1726,7 +1726,7 @@ private void Initialize()
}

// 格式化备份目录
var sources = _jobConfig.Sources.Where(c => !string.IsNullOrWhiteSpace(c)).Select(c => c.TrimPath()).Distinct().ToList();
var sources = _jobConfig.Sources.Where(c => !string.IsNullOrWhiteSpace(c)).Distinct().ToList();
_jobConfig.Sources.Clear();
foreach (var item in sources)
{
Expand All @@ -1737,7 +1737,7 @@ private void Initialize()
{
dir.Create();
}
_jobConfig.Sources.Add($"{dir.FullName.TrimPath()}");
_jobConfig.Sources.Add(dir.FullName);
}
else
{
Expand Down

0 comments on commit da9f149

Please sign in to comment.