Skip to content

fix(cli): use POSIX paths in CapApp-SPM Package.swift - #8549

Merged
markemer merged 1 commit into
ionic-team:mainfrom
omriwil:fix/spm-package-swift-unix-paths
Aug 6, 2026
Merged

fix(cli): use POSIX paths in CapApp-SPM Package.swift#8549
markemer merged 1 commit into
ionic-team:mainfrom
omriwil:fix/spm-package-swift-unix-paths

Conversation

@omriwil

@omriwil omriwil commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • On Windows, cap sync / cap update writes CapApp-SPM/Package.swift plugin path: values using path.relative(), which produces backslashes.
  • Swift string literals treat \ as an escape, so Xcode reports Invalid escape sequence in literal (e.g. \@, \a in ..\node_modules\@capacitor\app).
  • Normalize those relative paths with convertToUnixPath, matching existing Android settings.gradle and iOS CocoaPods Podfile generation.

Test plan

  • On Windows: npx cap sync ios with an SPM app and local Capacitor plugins
  • Confirm ios/App/CapApp-SPM/Package.swift dependency paths use / only (no \)
  • On macOS: open the project in Xcode and confirm Package.swift parses with no escape-sequence errors
  • On macOS: npx cap sync ios still produces correct paths (no regression)

Related prior fix for the same class of bug on CocoaPods: #5494

On Windows, path.relative() emits backslashes that break Swift string
literals in the generated Package.swift. Match Android/CocoaPods and
normalize with convertToUnixPath.

Co-authored-by: Cursor <cursoragent@cursor.com>
@markemer markemer self-assigned this Aug 5, 2026
@markemer
markemer requested a review from theproducer August 5, 2026 17:32
@markemer
markemer merged commit 5e5bb3b into ionic-team:main Aug 6, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants