Skip to content

Commit

Permalink
(GH-60) Fix: Pin errors on pkg folders w/versions
Browse files Browse the repository at this point in the history
If the package folder has a version on it, it is considered a side by
side path, so the package manager may not be able to resolve the path
to the locally installed nupkg. When it isn't found by regular means,
attempt to find it by looking for it in side by side paths. If it is
not found there either, go ahead and error.
  • Loading branch information
ferventcoder committed Jun 5, 2015
1 parent a85adab commit 3c8ea92
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,17 @@ public void set_pin(IPackageManager packageManager, ChocolateyConfiguration conf
IPackage installedPackage = packageManager.LocalRepository.FindPackage(config.PinCommand.Name, semanticVersion);
if (installedPackage == null)
{
throw new ApplicationException("Unable to find package named '{0}'{1} to pin. Please check to ensure it is installed.".format_with(config.PinCommand.Name, versionUnspecified ? "" : " (version '{0}')".format_with(config.Version)));
var pathResolver = packageManager.PathResolver as ChocolateyPackagePathResolver;
if (pathResolver != null)
{
pathResolver.UseSideBySidePaths = true;
installedPackage = packageManager.LocalRepository.FindPackage(config.PinCommand.Name, semanticVersion);
}

if (installedPackage == null)
{
throw new ApplicationException("Unable to find package named '{0}'{1} to pin. Please check to ensure it is installed.".format_with(config.PinCommand.Name, versionUnspecified ? "" : " (version '{0}')".format_with(config.Version)));
}
}

var pkgInfo = _packageInfoService.get_package_information(installedPackage);
Expand Down

0 comments on commit 3c8ea92

Please sign in to comment.