Prevent a NRE while looking for git location

This commit is contained in:
_aLfa_ 2014-09-23 18:10:20 +02:00
parent 25de0f9112
commit 9e9bb0eba1

View File

@ -12,9 +12,14 @@ namespace UpdateAssemblyInfo
if (File.Exists(p))
return p;
p = Path.Combine(Environment.GetEnvironmentVariable("ProgramFiles(x86)"), @"Git\bin\git.exe");
// This variable doesn't get set on every Windows configuration. (@alfaproject vm for example)
var programFiles = Environment.GetEnvironmentVariable("ProgramFiles(x86)");
if (programFiles != null)
{
p = Path.Combine(programFiles, @"Git\bin\git.exe");
if (File.Exists(p))
return p;
}
p = @"C:\Program Files\Git\bin\git.exe";
if (File.Exists(p))