Created
January 12, 2014 08:44
-
-
Save laiso/8382366 to your computer and use it in GitHub Desktop.
Command to open a iPhone Simulator home directory.
http://d.hatena.ne.jp/laiso+iphone/20140112/1389516507
This file contains hidden or 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
#!/bin/sh | |
usage() | |
{ | |
echo " iossim-home [-d SDK] APPNAME\n" | |
exit | |
} | |
IOSSDK_VERSION="" | |
while getopts "d:" OPT | |
do | |
case $OPT in | |
d) | |
IOSSDK_VERSION=${OPTARG} | |
;; | |
esac | |
done | |
shift `expr $OPTIND - 1` | |
ARGBASENAME=$(echo $1 | xargs -0 basename) | |
if [ ! -n $ARGBASENAME ]; then | |
ARGBASENAME=$(echo $1 | sed -e "s/\///g") | |
fi | |
IOSAPPNAME="${ARGBASENAME}.app" | |
IOSAPPPATH=$(mdfind -name $IOSAPPNAME -onlyin ~/Library/Application\ Support/iPhone\ Simulator/ | grep "iPhone Simulator/${IOSSDK_VERSION}" | head -n 1) | |
OPENPATH=$(echo "${IOSAPPPATH}" | sed -e "s/${IOSAPPNAME}//g") | |
if [ ! -d "${OPENPATH}" ]; then | |
echo "[ERROR] Couldn't find the app path." | |
exit 1 | |
fi | |
open "${OPENPATH}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment