From ec3694c788d2b32eb1735687cf89b057d4ca4d4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Fri, 4 Sep 2015 22:08:57 +0200 Subject: [PATCH] Make simulator dependant of currently active dev directory This also gets rid of `xcode-select` command-not-found errors. --- plugins/xcode/xcode.plugin.zsh | 17 ++++++++++++----- 1 file 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 +}