[TxMt] XCode bundle command to share.

Scott Andrew scottandrew at adelphia.net
Tue Sep 19 04:08:50 UTC 2006

Here is a command that i added to my XCode bundle to set a breakpoint  
in the front most file. Note that this assumes that the project is  
open in XCode. Thanks for the help on this list to make this work. In  
case you are wondering why the name of the file and not the path  
name.. The file reference type for XCode uses the name of the source  
file only.

#!/usr/bin/env ruby
# import the frontmost opened project window in Xcode

proect = %x{"#{ENV['TM_BUNDLE_SUPPORT']}/bin/find_xcode_project.rb"}
named = File.basename(proect)
xCodeProject = named.sub(/\.(xcodeproj|xcode|pbproj)\/?$/, "").chomp

%x{osascript -e 'tell application "TextMate"
	set myName to name of front document
end tell
tell application "Xcode"
	tell project named "#{xCodeProject}"
        	set bp to make new file breakpoint with properties {line  
		set file reference of bp to file reference named myName
		set enabled of bp to true
	end tell
end tell'}

More information about the textmate mailing list