-
-
Save yiyuanlu/3045806 to your computer and use it in GitHub Desktop.
cd to current Xcode's project folder in Terminal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cdxcode() | |
{ | |
path="`osascript ~/Codes/scripts/cdxcode.scpt 2>/dev/null`" | |
if [ -n "$path" ]; then | |
echo "cd to $path" | |
cd "$path" | |
else | |
echo "no Xcode Project finded" | |
fi | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
to split(aString, delimiter) | |
set oldastid to AppleScript's text item delimiters | |
set AppleScript's text item delimiters to delimiter | |
set pieces to aString's text items | |
set AppleScript's text item delimiters to oldastid | |
return pieces | |
end split | |
tell application id "com.apple.dt.Xcode" | |
set my_work_space to active workspace document | |
-- set my_projects to projects of my_work_space | |
-- set my_project to item 1 of my_projects | |
set my_windows to windows | |
set my_window to item 1 of my_windows | |
set window_name to name of my_window | |
tell me | |
set ppp to split(window_name, ".xcodeproj") | |
end tell | |
set projname to item 1 of ppp | |
tell project projname | |
set xxxxxx to project directory | |
end tell | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment