XcodesOrg / xcodes

The best command-line tool to install and switch between multiple versions of Xcode.
MIT License
3.82k stars 133 forks source link

Ignore malformed Xcode app bundles #88

Closed interstateone closed 4 years ago

interstateone commented 4 years ago

This changes Files.installed Xcodes to ignore app bundles that don't contain Info.plist files at the expected location instead of crashing. This change doesn't include a test to verify the new behaviour because the Entry type in the Path library doesn't have an accessible initializer, which is required to construct some test data without creating what I thought would be too many workarounds for testing's sake.

Manual test steps:

  1. Create a directory in /Applications with a unique name like Xcode.app or Xcode-12.app.
  2. make
  3. .build/release/xcodes list should print the list of available and installed Xcodes and not crash

Closes #87

csykes commented 4 years ago

Hmmm... I still get the crash

chad@Chads-Mac ~/d/xcodes> mkdir /Applications/xcode-test.app
chad@Chads-Mac ~/d/xcodes> .build/release/xcodes list
Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=260 "The file “Info.plist” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Applications/xcode-test.app/Contents/Info.plist, NSUnderlyingError=0x7fb1026050f0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}: file /Users/chad/dev/xcodes/Sources/XcodesKit/Environment.swift, line 107
fish: '.build/release/xcodes list' terminated by signal SIGILL (Illegal instruction)
csykes commented 4 years ago

Ummm... on the master branch... is it just me or is this branch invisible on Github?

interstateone commented 4 years ago

Ummm... on the master branch... is it just me or is this branch invisible on Github?

It's from a fork, so it's not as straightforward to test as when it's in this remote.

Screen Shot 2020-02-07 at 9 32 07 AM