Skip to content

Commit

Permalink
Update logic for checking duplicate before download
Browse files Browse the repository at this point in the history
  • Loading branch information
JL03-Yue committed Sep 18, 2023
1 parent 38ee802 commit 78dd94c
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions src/Cli/dotnet/ToolPackage/ToolPackageDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,23 +110,18 @@ public IToolPackage InstallPackage(PackageLocation packageLocation, PackageId pa
packageId,
packageVersion.ToNormalizedString()));
}
}
NuGetv3LocalRepository localRepository = new(toolDownloadDir.Value);
var package = localRepository.FindPackage(packageId.ToString(), packageVersion);
if (package == null)
{
DownloadAndExtractPackage(packageLocation, packageId, nugetPackageDownloader, toolDownloadDir.Value, _toolPackageStore, packageVersion, packageSourceLocation).GetAwaiter().GetResult();
}
else if(isGlobalTool)
else
{
throw new ToolPackageException(
string.Format(
CommonLocalizableStrings.ToolPackageConflictPackageId,
packageId,
packageVersion.ToNormalizedString()));
}
NuGetv3LocalRepository localRepository = new(toolDownloadDir.Value);
var package = localRepository.FindPackage(packageId.ToString(), packageVersion);
if (package == null)
{
DownloadAndExtractPackage(packageLocation, packageId, nugetPackageDownloader, toolDownloadDir.Value, _toolPackageStore, packageVersion, packageSourceLocation).GetAwaiter().GetResult();
}
}
CreateAssetFile(packageId, packageVersion, toolDownloadDir, assetFileDirectory, _runtimeJsonPath, targetFramework);
DirectoryPath toolReturnPackageDirectory;
Expand Down

0 comments on commit 78dd94c

Please sign in to comment.