Skip to content

Commit 7c07ea2

Browse files
committed
Throw exception if the log file directory is null.
1 parent 598d9de commit 7c07ea2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/GitVersionExe/Program.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,11 @@ static void ConfigureLogging(Arguments arguments)
132132
var logFileFullPath = Path.GetFullPath(arguments.LogFilePath);
133133
var logFile = new FileInfo(logFileFullPath);
134134

135-
if (logFile.Directory != null && !logFile.Directory.Exists)
136-
{
137-
// TODO: This should probably be done recursively. @asbjornu
135+
if (logFile.Directory == null)
136+
throw new DirectoryNotFoundException(String.Format("The directory of {0} does not exist.", logFile));
137+
138+
if (!logFile.Directory.Exists)
138139
logFile.Directory.Create();
139-
}
140140

141141
if (!logFile.Exists)
142142
{

0 commit comments

Comments
 (0)