Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions scripts/powershell/common.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,15 @@ function Resolve-SpecifyInitDir {
}
# Resolve-Path echoes back any trailing separator from the input; trim it so
# the returned root matches the bash resolver, whose `cd && pwd` never yields
# one. TrimEndingDirectorySeparator is a no-op on a bare root and on a path
# that already has no trailing separator.
$initRoot = [System.IO.Path]::TrimEndingDirectorySeparator($resolved.Path)
# one. Use TrimEnd (not [Path]::TrimEndingDirectorySeparator, which is .NET
# Core only and throws on Windows PowerShell 5.1 / .NET Framework — see the
# matching note further below). TrimEnd is a no-op on a path with no trailing
# separator; the one difference is a bare drive root (`C:\` -> `C:`), so keep
# that separator to preserve a valid rooted path.
$initRoot = $resolved.Path.TrimEnd('/', '\')
if ($initRoot -match '^[A-Za-z]:$') {
$initRoot = $resolved.Path
}
Comment on lines +63 to +66
if (-not (Test-Path -LiteralPath (Join-Path $initRoot '.specify') -PathType Container)) {
[Console]::Error.WriteLine("ERROR: SPECIFY_INIT_DIR is not a Spec Kit project (no .specify/ directory): $initRoot")
if ($ReturnNullOnError) { return $null }
Expand Down
Loading