summaryrefslogtreecommitdiff
path: root/plugins/xcode/xcode.plugin.zsh
diff options
context:
space:
mode:
authorMarc Cornellà <marc.cornella@live.com>2015-09-04 22:08:57 +0200
committerMarc Cornellà <marc.cornella@live.com>2015-09-05 22:47:52 +0200
commitec3694c788d2b32eb1735687cf89b057d4ca4d4d (patch)
tree13a061ed49bb440e2e69e0d576aaf7fca5e6a448 /plugins/xcode/xcode.plugin.zsh
parent24bdd8e29a344f0282b842f89a4a10f145344939 (diff)
downloadzsh-ec3694c788d2b32eb1735687cf89b057d4ca4d4d.tar.gz
zsh-ec3694c788d2b32eb1735687cf89b057d4ca4d4d.tar.bz2
zsh-ec3694c788d2b32eb1735687cf89b057d4ca4d4d.zip
Make simulator dependant of currently active dev directory
This also gets rid of `xcode-select` command-not-found errors.
Diffstat (limited to 'plugins/xcode/xcode.plugin.zsh')
-rw-r--r--plugins/xcode/xcode.plugin.zsh17
1 files changed, 12 insertions, 5 deletions
diff --git a/plugins/xcode/xcode.plugin.zsh b/plugins/xcode/xcode.plugin.zsh
index 059c78fd5..f80de36d5 100644
--- a/plugins/xcode/xcode.plugin.zsh
+++ b/plugins/xcode/xcode.plugin.zsh
@@ -17,8 +17,15 @@ alias xcb='xcodebuild'
alias xcp='xcode-select --print-path'
alias xcdd='rm -rf ~/Library/Developer/Xcode/DerivedData/*'
-if [[ -d $(xcode-select -p)/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app ]]; then
- alias simulator='open $(xcode-select -p)/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app'
-else
- alias simulator='open $(xcode-select -p)/Applications/iOS\ Simulator.app'
-fi
+function simulator {
+ local devfolder
+ devfolder="$(xcode-select -p)"
+
+ # Xcode ≤ 5.x
+ if [[ -d "${devfolder}/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app" ]]; then
+ open "${devfolder}/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app"
+ # Xcode ≥ 6.x
+ else
+ open "${devfolder}/Applications/iOS Simulator.app"
+ fi
+}