From 8e6279d3a1fb37f9bb77f33de860401e64f597c9 Mon Sep 17 00:00:00 2001 From: SimonCropp Date: Tue, 7 Apr 2020 05:28:41 +1000 Subject: [PATCH] temp file should exist --- src/DiffEngine/DiffRunner.cs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/DiffEngine/DiffRunner.cs b/src/DiffEngine/DiffRunner.cs index c48db96f64..9b755b9a62 100644 --- a/src/DiffEngine/DiffRunner.cs +++ b/src/DiffEngine/DiffRunner.cs @@ -43,7 +43,7 @@ public static void Kill(string tempFile, string targetFile) public static LaunchResult Launch(DiffTool tool, string tempFile, string targetFile) { - Guard.AgainstNullOrEmpty(tempFile, nameof(tempFile)); + Guard.FileExists(tempFile, nameof(tempFile)); Guard.AgainstNullOrEmpty(targetFile, nameof(targetFile)); var extension = Extensions.GetExtension(tempFile); if (!DiffTools.TryFind(tool, extension, out var resolvedTool)) @@ -59,7 +59,7 @@ public static LaunchResult Launch(DiffTool tool, string tempFile, string targetF /// public static LaunchResult Launch(string tempFile, string targetFile) { - Guard.AgainstNullOrEmpty(tempFile, nameof(tempFile)); + Guard.FileExists(tempFile, nameof(tempFile)); Guard.AgainstNullOrEmpty(targetFile, nameof(targetFile)); var extension = Extensions.GetExtension(tempFile); @@ -77,14 +77,6 @@ static LaunchResult Launch(ResolvedDiffTool diffTool, string tempFile, string ta { return LaunchResult.TooManyRunningDiffTools; } - //TODO: throw if both dont exist - if (!File.Exists(tempFile)) - { - if (!AllFiles.TryCreateFile(tempFile, true)) - { - return LaunchResult.NoEmptyFileForExtension; - } - } if (!File.Exists(targetFile)) {