Bug 122698: Detect currently running instance of SeaMonkey when app is launched a second time, r=neil, sr=jag

This commit is contained in:
ajschult%verizon.net 2006-04-08 03:00:42 +00:00
parent 5dbeb97916
commit 7984993b41

View File

@ -36,7 +36,7 @@
#
# ***** END LICENSE BLOCK *****
## $Id: mozilla.in,v 1.10 2005/12/19 23:56:29 bugzilla%arlen.demon.co.uk Exp $
## $Id: mozilla.in,v 1.11 2006/04/08 03:00:42 ajschult%verizon.net Exp $
##
## Usage:
##
@ -95,65 +95,108 @@ moz_pis_startstop_scripts()
moz_libdir=%MOZAPPDIR%
MRE_HOME=%MREDIR%
# honor MOZILLA_FIVE_HOME if it's there
if [ -n "$MOZILLA_FIVE_HOME" ] ; then
dist_bin="$MOZILLA_FIVE_HOME"
# Use run-mozilla.sh in the current dir if it exists
# If not, then start resolving symlinks until we find run-mozilla.sh
found=0
progname="$0"
curdir=`dirname "$progname"`
progbase=`basename "$progname"`
run_moz="$curdir/run-mozilla.sh"
if test -x "$run_moz"; then
dist_bin="$curdir"
found=1
else
# Use run-mozilla.sh in the current dir if it exists
# If not, then start resolving symlinks until we find run-mozilla.sh
found=0
progname=$0
curdir=`dirname "$progname"`
run_moz="$curdir/run-mozilla.sh"
if test -x "$run_moz"; then
dist_bin=$curdir
found=1
else
here=`/bin/pwd`
while [ -h "$progname" ]; do
bn=`basename "$progname"`
cd `dirname "$progname"`
progname=`/bin/ls -l "$bn" |sed -e 's/^.* -> //' `
if [ ! -x "$progname" ]; then
break
fi
curdir=`dirname "$progname"`
run_moz="$curdir/run-mozilla.sh"
if [ -x "$run_moz" ]; then
cd "$curdir"
dist_bin=`pwd`
found=1
break
fi
done
cd "$here"
fi
if [ $found = 0 ]; then
# Check default compile-time libdir
if [ -x "$moz_libdir/run-mozilla.sh" ]; then
dist_bin=$moz_libdir
run_moz="$moz_libdir/run-mozilla.sh"
else
echo "Cannot find %MOZ_APP_DISPLAYNAME% runtime directory. Exiting."
exit 1
here=`/bin/pwd`
while [ -h "$progname" ]; do
bn=`basename "$progname"`
cd `dirname "$progname"`
progname=`/bin/ls -l "$bn" | sed -e 's/^.* -> //' `
if [ ! -x "$progname" ]; then
break
fi
curdir=`dirname "$progname"`
run_moz="$curdir/run-mozilla.sh"
if [ -x "$run_moz" ]; then
cd "$curdir"
dist_bin=`pwd`
run_moz="$dist_bin/run-mozilla.sh"
found=1
break
fi
done
cd "$here"
fi
if [ $found = 0 ]; then
# Check default compile-time libdir
if [ -x "$moz_libdir/run-mozilla.sh" ]; then
dist_bin="$moz_libdir"
run_moz="$moz_libdir/run-mozilla.sh"
else
echo "Cannot find %MOZ_APP_DISPLAYNAME% runtime directory. Exiting."
exit 1
fi
fi
script_args=""
debugging=0
MOZILLA_BIN="%MOZILLA-BIN%"
MOZ_CLIENT_PROGRAM="$dist_bin/mozilla-xremote-client"
if [ "$OSTYPE" = "beos" ]; then
mimeset -F $MOZILLA_BIN
mimeset -F "$MOZ_CLIENT_PROGRAM"
fi
# Open a new tab/window in an existing instance if we can find one.
if "${run_moz}" "$MOZ_CLIENT_PROGRAM" -a "${progbase}" 'ping()' 2>/dev/null >/dev/null; then
if [ $# -eq 0 ]; then
# No command line args. Open new window.
exec "${run_moz}" "$MOZ_CLIENT_PROGRAM" -a "${progbase}" "xfeDoCommand(openBrowser)"
fi
case "$1" in
-mail)
exec "${run_moz}" "$MOZ_CLIENT_PROGRAM" -a "${progbase}" 'xfeDoCommand(openInbox)'
;;
-compose)
exec "${run_moz}" "$MOZ_CLIENT_PROGRAM" -a "${progbase}" 'xfeDoCommand(composeMessage)'
;;
-*)
# There's an argument we don't recognize, so don't try to use a running
# instance.
;;
*)
# If there's a command line argument but it doesn't begin with a -
# it's probably a url. Try to send it to a running instance.
eval _optLast=\$$#
if [ `expr "${_optLast}" : '.*:/.*'` -eq 0 -a \( -f "${_optLast}" -o -d "${_optLast}" \) ]; then
# Last argument seems to be a local file/directory, so prepend "file://"
# First, check if it is absolutely specified (ie. /home/foo/file vs. ./file)
# If it is just "relatively" (./file) specified, make it absolutely
if [ `expr "${_optLast}" : '/.*'` -eq 0 ]; then
_optLast="`pwd`/${_optLast}"
fi
_optLast="file://${_optLast}"
fi
exec "${run_moz}" "$MOZ_CLIENT_PROGRAM" -a "${progbase}" "openURL(${_optLast})"
;;
esac
fi
# Default action - no running instance
script_args=""
debugging=0
MOZILLA_BIN="${progbase}-bin"
if [ "$OSTYPE" = "beos" ]; then
mimeset -F "$MOZILLA_BIN"
fi
pass_arg_count=0
while [ $# -gt $pass_arg_count ]
do
case "$1" in
-p | -pure)
MOZILLA_BIN="%MOZILLA-BIN%.pure"
-p | --pure | -pure)
MOZILLA_BIN="${MOZILLA_BIN}.pure"
shift
;;
-g | --debug)