remove redundant packagesRoot path check and reorder methods
This commit is contained in:
parent
444dd6a031
commit
aa7fb60d73
2 changed files with 18 additions and 18 deletions
|
@ -201,9 +201,24 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
yield return packageFolder.Path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var nuGetPathContext = NuGetPathContext.Create(project.ProjectRoot);
|
||||
yield return nuGetPathContext.UserPackageFolder;
|
||||
private LockFile GetToolLockFile(
|
||||
SingleProjectInfo toolLibrary,
|
||||
IEnumerable<string> possibleNugetPackagesRoot,
|
||||
out string nugetPackagesRoot)
|
||||
{
|
||||
foreach (var packagesRoot in possibleNugetPackagesRoot)
|
||||
{
|
||||
if (TryGetToolLockFile(toolLibrary, packagesRoot, out LockFile lockFile))
|
||||
{
|
||||
nugetPackagesRoot = packagesRoot;
|
||||
return lockFile;
|
||||
}
|
||||
}
|
||||
|
||||
nugetPackagesRoot = null;
|
||||
return null;
|
||||
}
|
||||
|
||||
private bool TryGetToolLockFile(
|
||||
|
@ -233,21 +248,6 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
return true;
|
||||
}
|
||||
|
||||
private LockFile GetToolLockFile(SingleProjectInfo toolLibrary, IEnumerable<string> possibleNugetPackagesRoot, out string nugetPackagesRoot)
|
||||
{
|
||||
foreach (var packagesRoot in possibleNugetPackagesRoot)
|
||||
{
|
||||
if (TryGetToolLockFile(toolLibrary, packagesRoot, out LockFile lockFile))
|
||||
{
|
||||
nugetPackagesRoot = packagesRoot;
|
||||
return lockFile;
|
||||
}
|
||||
}
|
||||
|
||||
nugetPackagesRoot = null;
|
||||
return null;
|
||||
}
|
||||
|
||||
private string GetToolLockFilePath(
|
||||
SingleProjectInfo toolLibrary,
|
||||
string nugetPackagesRoot)
|
||||
|
|
|
@ -138,7 +138,7 @@ namespace Microsoft.DotNet.Tests
|
|||
.WithWorkingDirectory(testInstance.Root)
|
||||
.ExecuteWithCapturedOutput("nonexistingtool")
|
||||
.Should().Fail()
|
||||
.And.HaveStdErrContaining("Version for package `dotnet-nonexistingtool` could not be resolved.");
|
||||
.And.HaveStdErrContaining("No executable found matching command \"dotnet-nonexistingtool\"");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
Loading…
Add table
Reference in a new issue