Skip to content

Commit

Permalink
(#508) Do not break local only listing if no lib directory
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCakeIsNaOH authored and gep13 committed Jan 6, 2023
1 parent d1e1022 commit 6d2ec7a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/chocolatey/infrastructure.app/services/NugetService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ public virtual int count_run(ChocolateyConfiguration config)
{
config.Sources = ApplicationParameters.PackagesLocation;
config.Prerelease = true;

if (!_fileSystem.directory_exists(ApplicationParameters.PackagesLocation))
{
return 0;
}
}

int? pageValue = config.ListCommand.Page;
Expand Down Expand Up @@ -135,6 +140,11 @@ public virtual IEnumerable<PackageResult> list_run(ChocolateyConfiguration confi
config.Sources = ApplicationParameters.PackagesLocation;
config.Prerelease = true;
config.ListCommand.IncludeVersionOverrides = true;

if (!_fileSystem.directory_exists(ApplicationParameters.PackagesLocation))
{
yield break;
}
}

if (config.RegularOutput) this.Log().Debug(() => "Running list with the following filter = '{0}'".format_with(config.Input));
Expand Down

0 comments on commit 6d2ec7a

Please sign in to comment.