Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion uSync.BackOffice/Legacy/SyncLegacyService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Threading.Tasks;

using uSync.BackOffice.Configuration;
using uSync.BackOffice.Services;
using uSync.Core;

Expand All @@ -27,17 +29,24 @@ internal class SyncLegacyService : ISyncLegacyService
};

private readonly ISyncFileService _syncFileService;
private readonly ISyncConfigService _configService;

public SyncLegacyService(ISyncFileService syncFileService)
public SyncLegacyService(ISyncFileService syncFileService, ISyncConfigService configService)
{
_syncFileService = syncFileService;
_configService = configService;
}

/// <inheritdoc/>
public bool TryGetLatestLegacyFolder([MaybeNullWhen(false)] out string? folder)
{
folder = null;

// if the default folder is not point to latest, then we don't check for legacy.
Comment thread
KevinJump marked this conversation as resolved.
var latest = _configService.GetFolders().Last();
Comment thread
KevinJump marked this conversation as resolved.
Outdated
if (latest.Contains($"uSync/v{_majorVersion}/", StringComparison.OrdinalIgnoreCase) is false)
return false;

for (int n = _majorVersion - 1; n > 8; n--)
{
var legacyFolder = $"~/uSync/v{n}";
Expand Down