Services do not work with multiple Xcode installs
Opened this issue · 1 comments
The app name "Xcode" is hard-coded in the services, which does not handle multiple Xcode installs very well. For instance, if I run the service from within a developer preview release named "Xcode45-DP4.app" the service will instead launch my primary Xcode.app install, attempt to query it for the current document, and fail.
I was able to resolve this locally using a combination of set app_name to path to frontmost application as text
to get a unique reference to the correct Xcode instance, and a using terms from application "Xcode"
block around the tell application "Xcode"
(now tell application app_name
) commands. There is probably a more robust solution, but I am unfamiliar with AppleScript so I will not be submitting a pull request for this issue based on my fix.
That actually seems pretty reasonable to me. I'm no AppleScript expert either, but it's pretty much what I would have done — get a ref to the frontmost app (given the workflow only functions with Xcode) and use it.
Submit a pull request if you can — if there's anything awry, I can fix it up after the merge.