Skip to content

Commit a49a26c

Browse files
HeyItsGilbertclaude
andcommitted
fix: address PR review comments
- Set PathToAdd = TargetParent in the file-extension branch so AddToPath prepends the directory, not the file itself - Return early after Write-Error when the parent directory is missing so AddToPath and subsequent steps are not reached with Path unset - Guard New-Item directory creation behind Install action so Test runs do not mutate the filesystem - Fix CHANGELOG wording to include 'windows' in the platform list Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 7b23e48 commit a49a26c

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12-
- `FileDownload` is now supported on all platforms (`core`, `macos`, `linux`); there was no Windows-only code blocking this (#98).
12+
- `FileDownload` is now supported on all platforms (`windows`, `core`, `macos`, `linux`); there was no Windows-only code blocking this (#98).
1313
- `FileDownload` relative `Target` paths are now rooted against `$PWD` before resolution, matching the intuitive expectation of callers (#49).
1414

1515
### Fixed

PSDepend/PSDependScripts/FileDownload.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,22 +94,22 @@ if (Test-Path $Target -PathType Leaf) {
9494
}
9595
elseif ([IO.Path]::GetExtension($Target) -and -not (Test-Path $Target -PathType Container)) {
9696
# Target has a file extension — treat as a full destination file path
97+
$PathToAdd = $TargetParent
9798
if (-not (Test-Path $TargetParent)) {
9899
Write-Error "Could not find parent path [$TargetParent] for target [$Target]"
99100
if ($PSDependAction -contains 'Test') {
100101
return $False
101102
}
103+
return
102104
}
103-
else {
104-
$Path = $Target
105-
$ToInstall = $True
106-
Write-Verbose "Target has extension, treating as file path [$Target]"
107-
}
105+
$Path = $Target
106+
$ToInstall = $True
107+
Write-Verbose "Target has extension, treating as file path [$Target]"
108108
}
109109
else {
110110
# No extension (or already a container) — treat target as a directory
111111
Write-Verbose "[$Target] is a container, creating path to file"
112-
if (-not (Test-Path $Target)) {
112+
if (-not (Test-Path $Target) -and $PSDependAction -contains 'Install') {
113113
New-Item -ItemType Directory -Path $Target -Force | Out-Null
114114
}
115115
If ($Name) {

0 commit comments

Comments
 (0)