Lea
0d4c76feb6
All checks were successful
Create zip and upload release / release (push) Successful in 42s
34 lines
688 B
Bash
Executable file
34 lines
688 B
Bash
Executable file
#!/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"
|
|
cp -r "./pack" "$TARGET_PATH"
|
|
echo "Reload the game with F3+T now"
|
|
}
|
|
build
|
|
while block_for_change; do
|
|
build
|
|
done |