mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-04-17 04:29:14 +02:00
Handle fallback if Xcode is not installed
If Xcode is not installed the active_path = /Library/Developer/CommandLineTools Thus if the active_path does not contain the word Xcode, we will fall back to opening the project file with the Finder's recommended program
This commit is contained in:
parent
447db36d6e
commit
0d60bdd1dd
1 changed files with 7 additions and 2 deletions
|
|
@ -15,8 +15,13 @@ function xc {
|
|||
else
|
||||
echo "Found ${xcode_proj[1]}"
|
||||
active_path=$(xcode-select -p)
|
||||
active_path=${active_path%%/Contents/Developer*}
|
||||
open -a "${active_path}" "${xcode_proj[1]}"
|
||||
if [[ ${active_path} =~ "Xcode" ]]; then
|
||||
active_path=${active_path%%/Contents/Developer*}
|
||||
echo "Opening with ${active_path}"
|
||||
open -a "${active_path}" "${xcode_proj[1]}"
|
||||
else # No Xcode installed
|
||||
open "${xcode_proj[1]}" # Fall back to using Finder suggested application
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue