Created
February 24, 2015 21:56
-
-
Save samdmarshall/a662888063498904ec62 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env sh | |
read -r -d '' script <<'EOF' | |
set working_dir_path to (do shell script "echo $PWD") | |
set working_dir to POSIX file working_dir_path | |
tell application "Xcode" | |
repeat with current_window in windows | |
repeat with workspace in documents of current_window | |
set workspace_name to name of workspace | |
set the item_list to list folder working_dir without invisibles | |
if item_list contains workspace_name then | |
set active_files to {} | |
repeat while (count of (source documents whose path contains working_dir_path)) > 0 | |
set active_documents to (source documents whose path contains working_dir_path) | |
repeat with source_document in active_documents | |
copy path of source_document to end of active_files | |
close source_document without saving | |
end repeat | |
end repeat | |
set active_files to reverse of active_files | |
repeat with file_path in active_files | |
do shell script "open -b com.apple.dt.Xcode " & file_path | |
end repeat | |
end if | |
end repeat | |
end repeat | |
end tell | |
EOF | |
osascript -e "$script" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment