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
@ -15,8 +15,13 @@ function xc {
|
|||||||
else
|
else
|
||||||
echo "Found ${xcode_proj[1]}"
|
echo "Found ${xcode_proj[1]}"
|
||||||
active_path=$(xcode-select -p)
|
active_path=$(xcode-select -p)
|
||||||
|
if [[ ${active_path} =~ "Xcode" ]]; then
|
||||||
active_path=${active_path%%/Contents/Developer*}
|
active_path=${active_path%%/Contents/Developer*}
|
||||||
|
echo "Opening with ${active_path}"
|
||||||
open -a "${active_path}" "${xcode_proj[1]}"
|
open -a "${active_path}" "${xcode_proj[1]}"
|
||||||
|
else # No Xcode installed
|
||||||
|
open "${xcode_proj[1]}" # Fall back to using Finder suggested application
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user