1
0
Fork 0
forked from Lea/ponk
ponk/scripts/development.sh

35 lines
698 B
Bash
Raw Normal View History

2023-07-10 20:35:06 +00:00
#!/bin/bash
if [ -z "$1" ]; then
echo "Pass the path to your game's resource pack directory as argument to this script!"
exit 1
fi
TARGET_PATH=$(realpath "$1")/ponk-dev
read -p "The directory \"$TARGET_PATH\" will be created or overwritten. Is this okay? [y/N] " -n 1 -r
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
echo
else
exit 1
fi
DIRECTORY_TO_OBSERVE="pack"
function block_for_change {
inotifywait --recursive \
--event modify,move,create,delete \
$DIRECTORY_TO_OBSERVE
}
function build {
echo "Copying pack to $TARGET_PATH"
rm -rf "$TARGET_PATH"
2023-07-10 20:52:40 +00:00
sleep 1
2023-07-10 20:35:06 +00:00
cp -r "./pack" "$TARGET_PATH"
echo "Reload the game with F3+T now"
}
build
while block_for_change; do
build
done