If an output directory is not specified, the deleted files list should be limited to each individual depot.

pull/151/head
Ryan Kistner 5 years ago
parent ac97c01107
commit 30312af050

@ -637,7 +637,7 @@ namespace DepotDownloader
GlobalDownloadCounter downloadCounter = new GlobalDownloadCounter(); GlobalDownloadCounter downloadCounter = new GlobalDownloadCounter();
var depotsToDownload = new List<DepotFilesData>(depots.Count); var depotsToDownload = new List<DepotFilesData>(depots.Count);
var allFileNames = new HashSet<String>(); var allFileNamesAllDepots = new HashSet<String>();
// First, fetch all the manifests for each depot (including previous manifests) and perform the initial setup // First, fetch all the manifests for each depot (including previous manifests) and perform the initial setup
foreach (var depot in depots) foreach (var depot in depots)
@ -647,7 +647,7 @@ namespace DepotDownloader
if (depotFileData != null) if (depotFileData != null)
{ {
depotsToDownload.Add(depotFileData); depotsToDownload.Add(depotFileData);
allFileNames.UnionWith(depotFileData.allFileNames); allFileNamesAllDepots.UnionWith(depotFileData.allFileNames);
} }
cts.Token.ThrowIfCancellationRequested(); cts.Token.ThrowIfCancellationRequested();
@ -655,7 +655,7 @@ namespace DepotDownloader
foreach (var depotFileData in depotsToDownload) foreach (var depotFileData in depotsToDownload)
{ {
await DownloadSteam3AsyncDepotFiles(cts, appId, downloadCounter, depotFileData, allFileNames); await DownloadSteam3AsyncDepotFiles(cts, appId, downloadCounter, depotFileData, allFileNamesAllDepots);
} }
Console.WriteLine("Total downloaded: {0} bytes ({1} bytes uncompressed) from {2} depots", Console.WriteLine("Total downloaded: {0} bytes ({1} bytes uncompressed) from {2} depots",
@ -879,7 +879,7 @@ namespace DepotDownloader
} }
private static async Task DownloadSteam3AsyncDepotFiles(CancellationTokenSource cts, uint appId, private static async Task DownloadSteam3AsyncDepotFiles(CancellationTokenSource cts, uint appId,
GlobalDownloadCounter downloadCounter, DepotFilesData depotFilesData, HashSet<String> allFileNames) GlobalDownloadCounter downloadCounter, DepotFilesData depotFilesData, HashSet<String> allFileNamesAllDepots)
{ {
var depot = depotFilesData.depotDownloadInfo; var depot = depotFilesData.depotDownloadInfo;
var depotCounter = depotFilesData.depotCounter; var depotCounter = depotFilesData.depotCounter;
@ -907,8 +907,17 @@ namespace DepotDownloader
{ {
var previousFilteredFiles = depotFilesData.previousManifest.Files.AsParallel().Where(f => TestIsFileIncluded(f.FileName)).Select(f => f.FileName).ToHashSet(); var previousFilteredFiles = depotFilesData.previousManifest.Files.AsParallel().Where(f => TestIsFileIncluded(f.FileName)).Select(f => f.FileName).ToHashSet();
// Of the list of files in the previous manifest, remove any file names that exist in the current set of all file names across all depots being downloaded // Check if we are writing to a single output directory. If not, each depot folder is managed independently
previousFilteredFiles.ExceptWith(allFileNames); if (string.IsNullOrWhiteSpace(ContentDownloader.Config.InstallDirectory))
{
// Of the list of files in the previous manifest, remove any file names that exist in the current set of all file names
previousFilteredFiles.ExceptWith(depotFilesData.allFileNames);
}
else
{
// Of the list of files in the previous manifest, remove any file names that exist in the current set of all file names across all depots being downloaded
previousFilteredFiles.ExceptWith(allFileNamesAllDepots);
}
foreach(var existingFileName in previousFilteredFiles) foreach(var existingFileName in previousFilteredFiles)
{ {

Loading…
Cancel
Save