Skip to content

Commit

Permalink
temp file should exist
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Apr 6, 2020
1 parent 7fbee12 commit 8e6279d
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/DiffEngine/DiffRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -59,7 +59,7 @@ public static LaunchResult Launch(DiffTool tool, string tempFile, string targetF
/// </summary>
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);

Expand All @@ -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))
{
Expand Down

0 comments on commit 8e6279d

Please sign in to comment.