From c838d8398bd79140b15387a679cbd4175c8a7678 Mon Sep 17 00:00:00 2001 From: Kevin Gosse Date: Thu, 30 Nov 2023 14:57:17 +0100 Subject: [PATCH] Fix the code to move the dumps --- tracer/build/_build/Build.Steps.cs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tracer/build/_build/Build.Steps.cs b/tracer/build/_build/Build.Steps.cs index de4108c609d8..b56b70880265 100644 --- a/tracer/build/_build/Build.Steps.cs +++ b/tracer/build/_build/Build.Steps.cs @@ -2712,23 +2712,27 @@ private void CopyDumpsToBuildData() private void CopyDumpsTo(AbsolutePath root) { + var dumpFolder = root / "dumps"; + if (Directory.Exists(TempDirectory)) { foreach (var dump in GlobFiles(TempDirectory, "coredump*", "*.dmp")) { - Logger.Information("Moving file '{Dump}' to '{Root}'", dump, root / "dumps"); + Logger.Information("Moving file '{Dump}' to '{Root}'", dump, dumpFolder); - MoveFileToDirectory(dump, root / "dumps", FileExistsPolicy.Overwrite); + MoveFileToDirectory(dump, dumpFolder, FileExistsPolicy.Overwrite); } } - else - { - Logger.Warning("TempDirectory '{TempDirectory}' does not exist, skipping dump copy", TempDirectory); - } foreach (var file in Directory.EnumerateFiles(TracerDirectory, "*.dmp", SearchOption.AllDirectories)) { - CopyFileToDirectory(file, root, FileExistsPolicy.OverwriteIfNewer); + if (Path.GetDirectoryName(file) == dumpFolder) + { + // The dump is already in the right location + continue; + } + + CopyFileToDirectory(file, dumpFolder, FileExistsPolicy.OverwriteIfNewer); } }