Fixed potential crash. Added more flexible search for command-line tools...

Fixed potential crash. Added more flexible search for command-line tools. Note the changes to otx.xccheckout and the .xcuserstate file were made automatically, so please cherry-pick around them…I don't have the git skills to exclude them in this pull request!

--Anthony