Skip to content

Commit 320852f

Browse files
authored
Use more explicit type moving when checking existance of file (#10152)
1 parent 6bf49bb commit 320852f

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

build/init.ps1

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,13 @@ Function Get-BuildTools {
7676
$FileDirectory = Join-Path $NuGetClientRoot $Path
7777
$FilesToMove = Get-ChildItem -Path $FolderUri -File
7878
foreach ($File in $FilesToMove) {
79-
if (-not (Test-Path (Join-Path $FileDirectory $File))) {
80-
$File | Move-Item -Destination $FileDirectory
79+
$DestinationFile = Join-Path $FileDirectory $File.Name
80+
81+
if (-not (Test-Path $DestinationFile)) {
82+
Move-Item -Path $File.FullName -Destination $FileDirectory
8183
}
8284
else {
83-
Write-Host "File '$File' already exists, skipping" -ForegroundColor Blue
85+
Write-Host "File '$($File.Name)' already exists, skipping" -ForegroundColor Blue
8486
}
8587
}
8688

0 commit comments

Comments
 (0)