#!/bin/sh 

function ksdiff_executable_path() {
  # See where the system thinks ksdiff is
  ksdiff_exec=`which ksdiff`
  if [ ! $ksdiff_exec > /dev/null ] ; then
    # if which doesn't know where ksdiff is, check the default install location
    if [ -e '/usr/local/bin/ksdiff' ] ; then
      ksdiff_exec='/usr/local/bin/ksdiff'
    else
      echo "Could not locate ksdiff" 1>&2
    fi
  fi
}

ksdiff_executable_path
if [ $ksdiff_exec > /dev/null ] ; then
  short_version=`"$ksdiff_exec" --short-version`
  bundle_version=$1
  if [[ $short_version == $bundle_version ]] ; then
    exit 0
  else
	echo "ksdiff needs to be updated" 1>&2
    exit 210;
  fi
else
  exit 1;
fi
