Problems with Perforce & Xcode
Problems with Perforce & Xcode
- Subject: Problems with Perforce & Xcode
- From: Eric Gorr <email@hidden>
- Date: Fri, 3 Oct 2008 16:33:50 -0400
For anyone who is experiencing the known problems using the built-in
SCM controls in Xcode with Perforce and has had to disable it, I
thought this might be interesting...
It is fairly easy to write a simple script to control p4 from the
command line and tell it to check out the current file:
#!/bin/sh
source ~/.bash_profile
p4 edit %%%{PBXFilePath}%%%
The problem with this is that one needs to switch out to another
application and come back to Xcode before Xcode will recognize that
the file can now be edited. The way I solved this problem was to
change the script to:
#!/bin/sh
source ~/.bash_profile
p4 edit %%%{PBXFilePath}%%%
SWITCHOUT=`osascript << ENDOFSCRIPT
tell application "Finder"
activate
end tell
ENDOFSCRIPT`
/Users/Eric/Projects/Personal/xcodecheckout/activatexcode.sh &
Then, activatexcode.sh looks like:
#!/bin/sh
source ~/.bash_profile
sleep 1
ACTIVATE=`osascript << ENDOFSCRIPT
tell application "Xcode"
activate
end tell
ENDOFSCRIPT`
However, this won't work to checkout the project file...so, the part
of a different script that deals with project files is:
#!/bin/sh
source ~/.bash_profile
PROJECT_PATH=`osascript << ENDOFSCRIPT
try
tell application "Xcode"
set projectPath to the POSIX path of (path of active project
document as text)
end tell
on error
do shell script ("echo 'Cancel'")
end try
ENDOFSCRIPT`
PROJECT_NAME=${PROJECT_PATH}
FULL_PROJECT_PATH="$PROJECT_NAME/project.pbxproj"
p4 edit "$FULL_PROJECT_PATH"
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden