#!/bin/bash

set -e

if [ -d bin ]; then
  cd bin
else
  echo "Please run this script from the source root folder"
  exit
fi

PWD=`dirname $0`

if [ -f $PWD/lv2-ttl-generator/lv2_ttl_generator.exe ]; then
  GEN=$PWD/lv2-ttl-generator/lv2_ttl_generator.exe
  EXT=dll
else
  GEN=$PWD/lv2-ttl-generator/lv2_ttl_generator
  if [ -d /Developer ]; then
    EXT=dylib
  else
    EXT=so
  fi
fi

FOLDERS=`find . -type d -name \*.lv2`

for i in $FOLDERS; do
  cd $i
  FILE=`ls *.$EXT | sort | head -n 1`
  $GEN ./$FILE
  cd ..
done

Make run() inputs const; Add lv2 gen script
Make run() inputs const; Add lv2 gen script
