Skip to content

Commit

Permalink
Handle missing directory when starting
Browse files Browse the repository at this point in the history
  • Loading branch information
huserben committed Sep 13, 2021
1 parent 3ce9560 commit 5d562d0
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions AzureArtifactManager/Services/AzureArtifactService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,19 @@ private async Task<string> FetchArtifactTool(bool isRetry = false)
var userProfile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
var artifactToolFolder = Path.Join(userProfile, artifactToolParentFolder);

var artifactToolExecutable = Directory.GetFiles(artifactToolFolder, "artifacttool.exe", SearchOption.AllDirectories).FirstOrDefault();
var artifactToolExecutable = string.Empty;

if (artifactToolExecutable == null)
try
{

artifactToolExecutable = Directory.GetFiles(artifactToolFolder, "artifacttool.exe", SearchOption.AllDirectories).FirstOrDefault();
}
catch (DirectoryNotFoundException)
{
artifactToolExecutable = null;
}

if (string.IsNullOrEmpty(artifactToolExecutable))
{
if (isRetry)
{
Expand Down

0 comments on commit 5d562d0

Please sign in to comment.