Skip to content

Commit 5001399

Browse files
dsward2claude
andcommitted
Check both #file-absolute and CWD-relative paths for the PipelineHelpers sibling
The sibling-checkout check (use ../PipelineHelpers when building from the umbrella monorepo, else fall back to GitHub) compared against a CWD- relative path, which isn't always the manifest's own directory (Xcode workspace builds, e.g.). Resolving purely from #file isn't a strict fix either -- a cached manifest could have a stale baked-in #file from a previous checkout location -- so this checks both the #file-derived absolute path and the original CWD-relative path, succeeding if either finds the sibling. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 8531932 commit 5001399

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

Package.swift

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,18 @@ import Foundation
44

55
// Use the local PipelineHelpers sibling when building from the umbrella monorepo;
66
// fall back to GitHub when used standalone.
7-
let pipelineHelpersDep: Package.Dependency = FileManager.default.fileExists(
8-
atPath: "../PipelineHelpers/Package.swift"
9-
) ? .package(path: "../PipelineHelpers")
10-
: .package(url: "https://github.com/dsward2/PipelineHelpers", branch: "main")
7+
// Check via both #file (absolute, compile-time) and CWD-relative (runtime) paths so
8+
// the sibling is found in all contexts: direct SwiftPM invocations, Xcode workspace
9+
// builds, and standalone Package.swift opens where a cached manifest might have a
10+
// stale baked-in #file from a previous location.
11+
let _manifestDir = URL(fileURLWithPath: #file).deletingLastPathComponent()
12+
let _siblingAbsPath = _manifestDir.appendingPathComponent("../PipelineHelpers/Package.swift").standardized.path
13+
let _siblingRelPath = "../PipelineHelpers/Package.swift"
14+
let _hasSibling = FileManager.default.fileExists(atPath: _siblingAbsPath)
15+
|| FileManager.default.fileExists(atPath: _siblingRelPath)
16+
let pipelineHelpersDep: Package.Dependency = _hasSibling
17+
? .package(path: "../PipelineHelpers")
18+
: .package(url: "https://github.com/dsward2/PipelineHelpers", branch: "main")
1119

1220
let package = Package(
1321
name: "LiveAudioServer",

0 commit comments

Comments
 (0)