Skip to content

Commit f9e7e93

Browse files
committed
more intelligent way of finding Exuberant ctags
fixes #772
1 parent 39c745d commit f9e7e93

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

OpenGrok

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -440,23 +440,35 @@ LocateBinary() {
440440

441441
FindExuberantCTags()
442442
{
443-
binary=`LocateBinary ctags-exuberant exctags ctags`
444-
if test $? -eq 1
445-
then
443+
#
444+
# Search for Exuberant ctags intelligently, skipping
445+
# over other ctags implementations.
446+
#
447+
binary=""
448+
found=0
449+
for program in ctags-exuberant exctags ctags; do
450+
for path in `echo $PATH | tr ':' '\n'`; do
451+
if [ -x "$path/$program" ]; then
452+
binary="$path/$program"
453+
454+
# Verify that this really is Exuberant Ctags.
455+
$binary --version 2>&1 | grep "Exuberant Ctags" > /dev/null
456+
if [ $? -eq 0 ]; then
457+
found=1
458+
break
459+
fi
460+
fi
461+
done
462+
if [ $found -eq 1 ]; then
463+
break;
464+
fi
465+
done
466+
if [ $found -ne 1 ]; then
446467
Error "Unable to determine Exuberant CTags command name" \
447468
"for ${OS_NAME} ${OS_VERSION}"
448469
return
449470
fi
450471

451-
# Verify that this really is Exuberant Ctags
452-
$binary --version 2>&1 | grep "Exuberant Ctags" > /dev/null
453-
if test $? -ne 0
454-
then
455-
Error "Unable to determine Exuberant CTags command name" \
456-
"for ${OS_NAME} ${OS_VERSION}\n(${binary} is not Exuberant CTags)"
457-
return
458-
fi
459-
460472
echo ${binary}
461473
}
462474

0 commit comments

Comments
 (0)