diff --git a/NuGet.config b/NuGet.config index 1c667bc1..7ee14b0c 100644 --- a/NuGet.config +++ b/NuGet.config @@ -5,6 +5,6 @@ - + diff --git a/tools/helper.psm1 b/tools/helper.psm1 index 577c99c8..0348f151 100644 --- a/tools/helper.psm1 +++ b/tools/helper.psm1 @@ -131,7 +131,7 @@ function Resolve-ProtoBufToolPath { if (-not $Script:protoc_Path) { Write-Log "Resolve the protobuf tools for auto-generating code" - $nugetPath = "~/.nuget/packages" + $nugetPath = Get-NugetPackagesPath $toolsPath = "$RepoRoot/tools" if (-not (Test-Path "$toolsPath/obj/project.assets.json")) { @@ -205,6 +205,23 @@ function Write-Log Write-Host -ForegroundColor $foregroundColor "${indentPrefix}${Message}" } +function Get-NugetPackagesPath +{ + if ($env:NUGET_PACKAGES) + { + return $env:NUGET_PACKAGES + } + + if ($IsWindowsEnv) + { + return "${env:USERPROFILE}\.nuget\packages" + } + else + { + return "${env:HOME}/.nuget/packages" + } +} + #region Start-ResGen $generated_code_template = @'