-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRunTextEditWithNewXMLTagInputManager.command
More file actions
executable file
·62 lines (52 loc) · 1.93 KB
/
RunTextEditWithNewXMLTagInputManager.command
File metadata and controls
executable file
·62 lines (52 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#! /bin/sh
#
# RunTextEditWithNewXMLTagInputManager <BuildProductsDir> ...
#
# Moves the existing XMLTagInputManager installation aside (searching in
# ~/Library/InputManagers, /Network/Library/InputManagers, and
# /Library/InputManagers in that order), symlinks back to the
# <BuildProductsDir>, launches TextEdit, waits a bit, swaps the
# old one back, and then waits for TextEdit to quit.
#
# Any arguments beyond the second one are just passed along to TextEdit.
#
# You can use it as a custom executable, but only for running, not debugging.
set -x
if [ $# -lt 1 ] ; then
echo "usage $0 <BuildProductsDir> ..."
exit 1
fi
BUILD_DIR=$1
shift
if [ \! -d "${BUILD_DIR}/XMLTagInputManager.bundle" -o \! -f "${BUILD_DIR}/Info" ] ; then
echo "There's no XMLTagInputManager to link to in ${BUILD_DIR}"
exit 1
fi
INSTALL_DIR=${HOME}/Library/InputManagers
if [ \! -d "${INSTALL_DIR}/XMLTagInputManager" -o \! -f "${INSTALL_DIR}/XMLTagInputManager/Info" ] ; then
INSTALL_DIR=/Network/Library/InputManagers
if [ \! -d "${INSTALL_DIR}/XMLTagInputManager" -o \! -f "${INSTALL_DIR}/XMLTagInputManager/Info" ] ; then
INSTALL_DIR=/Library/InputManagers
if [ \! -d "${INSTALL_DIR}/XMLTagInputManager" -o \! -f "${INSTALL_DIR}/XMLTagInputManager/Info" ] ; then
echo "Cannot find an installed XMLTagInputManager."
exit 1
fi
fi
fi
# Move aside the real one
cd "${INSTALL_DIR}"
mv XMLTagInputManager/Info XMLTagInputManager/Info.%%aside%%
mv XMLTagInputManager XMLTagInputManager.%%aside%%
# Link to the BUILD_DIR
ln -s "${BUILD_DIR}" XMLTagInputManager
# Run TextEdit
/Applications/TextEdit.app/Contents/MacOS/TextEdit $* &
# Wait
sleep 5
# Restore everything
cd "${INSTALL_DIR}"
rm XMLTagInputManager
mv XMLTagInputManager.%%aside%% XMLTagInputManager
mv XMLTagInputManager/Info.%%aside%% XMLTagInputManager/Info
# This seems not to really exit until TextEdit does, which is just what we want.
exit 0