summarylogtreecommitdiffstats
path: root/qtc
blob: 274ad5a1386974bee0cc0454255aaeb87826acc5 (plain)
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
#!/usr/bin/env bash

#set -x

qtcreator_bin=qtcreator

if [[ "$(uname -s)" = "Darwin" ]]; then
  open -a "Qt Creator" $@
else
  # As of Qt Creator 4
  pid=$(pidof $qtcreator_bin)
  if [[ "${pid}" = "" ]]; then
    # Check for legacy versions
    qtcreator_bin=qtcreator-bin
    pid=$(pidof $qtcreator_bin)
  fi

  # find existing creator instance
  if [[ "${pid}" != "" ]]; then
    resident_qtcreator_bin=$(ls -l /proc/${pid}/exe | awk '{ print $11 }')
    ${resident_qtcreator_bin} -client $@
    exit 0
  fi

  # failing that run the creator in your path
  $qtcreator_bin $@
fi

exit 0