From 187a2a7f450f3e4e32e6749352fd58d6c0dec843 Mon Sep 17 00:00:00 2001 From: Thomas Broust Date: Fri, 19 Sep 2014 15:57:26 +0200 Subject: [PATCH] Creates the output folder if it doesn't exist --- NUnit HTML Report Generator/Program.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/NUnit HTML Report Generator/Program.cs b/NUnit HTML Report Generator/Program.cs index b6b474e..eb7393c 100644 --- a/NUnit HTML Report Generator/Program.cs +++ b/NUnit HTML Report Generator/Program.cs @@ -155,9 +155,27 @@ private static bool CheckInputAndOutputFile(string input, string output) Console.WriteLine("File does not exist"); } + if (ok) + { + CreateFolder(output); + } + return ok; } + /// + /// Creates the folder of a file path if it doesn't exist + /// + /// The path to the file + private static void CreateFolder(string folderPath) + { + string fullPath = Path.GetFullPath(folderPath); + if (!Directory.Exists(folderPath)) + { + Directory.CreateDirectory(folderPath); + } + } + #endregion #region Processing