#!/bin/sh

OS=$(uname -s)
PROJ_DIR="$(pwd)"
CHEATNT_DIR="$PROJ_DIR/.cheatnt"
CHEATNT_BIN="$PROJ_DIR/../build/cheatnt_client"

export DYLD_LIBRARY_PATH="../vendor/efsw/build:../vendor/libuiohook/build"

if [[ -e $CHEATNT_DIR ]]; then
	if [[ $OS == "Linux" ]]; then
		sudo chattr +i .
	elif [[ $OS == "Darwin" ]]; then
		# sudo chflags -R noschg .
		# python init_db.py $PROJ_DIR hello-world
		$CHEATNT_BIN "$PROJ_DIR" & echo $! > $CHEATNT_DIR/.procs
		echo ".procs created"
		# python cheatnt.py $PROJ_DIR vscode $PROJ_DIR & echo $! > $CHEATNT_DIR/.procs
	elif [[ $OS == "Windows" ]]; then
		echo die trash
	fi
else
	echo "cheatnt wasn't initialized"
fi
