#!/bin/sh # TODO: port this to nimscript cd "$(dirname $0)/.." [ $NIM ] || NIM="${HOME}/nimskull/bin/nim" OUT_NAME=game MAIN_FILE=src/main.nim MAIN_FILE_NAME=main JSON="$HOME/.cache/nimskull/${MAIN_FILE_NAME}_d/$OUT_NAME.json" function build(){ $NIM c "$@" "$MAIN_FILE" && (pkill -9 game; build/game &) } function file_list(){ if [ -e $JSON ]; then cat $JSON | grep '/@m.*\.nim\.c.o",' | sed -e 's_.*@m\(.*\).c.o",_src/\1_' -e 's_@s_/_g' fi find -iname "*.nim" find -iname "*.blend" } # for p in $(file_list);do echo $p;done build "$@" while inotifywait -e modify $(file_list) ;do build "$@" done