Skip to content

Instantly share code, notes, and snippets.

@thefotes
Created January 25, 2016 18:46
Show Gist options
  • Save thefotes/c2c04a5f807201744321 to your computer and use it in GitHub Desktop.
Save thefotes/c2c04a5f807201744321 to your computer and use it in GitHub Desktop.
Checks current directory for either .xcworkspace or .xcodeproj, if it finds xcworkspace opens that, otherwise opens xcodeproj
#!/bin/bash
set -e
xcodeproj=`find . -maxdepth 1 -name "*.xcodeproj"`
proj_name=`echo $xcodeproj | sed 's/.\///g' | sed 's/.xcodeproj//g'`
xcworkspace=`find . -maxdepth 1 -name "$proj_name.xcworkspace"`
if [[ ! -z $xcworkspace && -e $xcworkspace ]]; then
open $xcworkspace
else
open $xcodeproj
fi
@thefotes
Copy link
Author

I thought this would take 5 minutes, it took me an hour because my first implementation based on a pretty poor assumption. In the future I would like to pass the file to open to an apple script of some kind so that it automatically opens maximized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment