File indexing completed on 2024-04-21 04:36:22
0001 #!/bin/sh 0002 0003 # This file is part of KDevelop 0004 # Copyright 2011 David Nolden <david.nolden.kdevelop@art-master.de> 0005 # 0006 # This library is free software; you can redistribute it and/or 0007 # modify it under the terms of the GNU Library General Public 0008 # License as published by the Free Software Foundation; either 0009 # version 2 of the License, or (at your option) any later version. 0010 # 0011 # This library is distributed in the hope that it will be useful, 0012 # but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0014 # Library General Public License for more details. 0015 # 0016 # You should have received a copy of the GNU Library General Public License 0017 # along with this library; see the file COPYING.LIB. If not, write to 0018 # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0019 # Boston, MA 02110-1301, USA. 0020 0021 export KDEV_BASEDIR=$(dirname $0) 0022 export APPLICATION=KDevelop 0023 0024 if ! [ "$KDEV_ATTACHED_PID" ]; then 0025 ARGS="" 0026 if [ $# -eq 0 ]; then 0027 ARGS="--pss" 0028 else 0029 ARGS="$@" 0030 fi 0031 export KDEV_ATTACHED_PID=$($KDEV_BASEDIR/kdevelop $ARGS --pid) 0032 fi 0033 0034 if ! [ "$KDEV_ATTACHED_PID" ]; then 0035 echo "Error: Failed retrieving a pid." 0036 exit 5 0037 fi 0038 0039 # Make sure we didn't capture garbage instead of the pid (must be 1 word only) 0040 # note: keep compatible on FreeBSD: https://bugs.kde.org/show_bug.cgi?id=311186 0041 if [ "$(echo $KDEV_ATTACHED_PID | wc -w | sed 's/ //g')" != 1 ]; then 0042 echo "Error: Got no valid pid." 0043 exit 6 0044 fi 0045 0046 # find qdbus, try also alternative name qdbus-qt5 0047 if ! $(command -v qdbus-qt5 &> /dev/null) && ! $(command -v qdbus &> /dev/null); then 0048 echo "Error: The qdbus (or qdbus-qt5) utility is missing." 0049 exit 7 0050 fi 0051 0052 export KDEV_DBUS_ID="org.kdevelop.kdevelop-$KDEV_ATTACHED_PID" 0053 0054 case $(basename $SHELL) in 0055 zsh) OLD_ZDOTDIR="${ZDOTDIR-$HOME}" ZDOTDIR="$KDEV_BASEDIR/../share/kdevplatform/shellutils/" zsh -i ;; 0056 *) bash --init-file "$KDEV_BASEDIR/kdevplatform_shell_environment.sh" -i ;; 0057 esac