1
0
Fork 0
mirror of https://codeberg.org/spire/spcomp.git synced 2026-06-03 16:44:08 +02:00

output fixes?

This commit is contained in:
Robin Appelman 2020-02-09 22:52:17 +01:00
commit d67ca5aa29

View file

@ -4,16 +4,10 @@ if [ -e "/include/*" ]; then
cp /include/* /scripting/include cp /include/* /scripting/include
fi fi
IN=$@ BASEDIR="$(pwd)"
cd $(dirname $IN)
IN="$(basename $IN)" IN=$*
OUT="${IN%.sp}.smx" OUT="$(basename "${IN%.sp}".smx)"
if [ "$IN" -ot "$OUT" ]; then
echo "Compiled file already up to date"
return
fi
if [ ! -z "$OUTPUT" ]; then if [ ! -z "$OUTPUT" ]; then
if [ "$IN" -ot "$OUTPUT" ]; then if [ "$IN" -ot "$OUTPUT" ]; then
@ -22,11 +16,20 @@ if [ ! -z "$OUTPUT" ]; then
fi fi
fi fi
/scripting/spcomp $IN cd "$(dirname "$IN")" || exit
IN="$(basename "$IN")"
if [ "$IN" -ot "$OUT" ]; then
echo "Compiled file already up to date"
return
fi
/scripting/spcomp "$IN"
OUT="${IN%.sp}.smx" OUT="${IN%.sp}.smx"
chown $(stat -c '%u' $IN):$(stat -c '%g' $IN) $OUT chown $(stat -c '%u' "$IN"):$(stat -c '%g' "$IN") "$OUT"
if [ -d "/output" ]; then if [ -d "/output" ]; then
cp $OUT /output cp $OUT /output
@ -34,5 +37,7 @@ fi
if [ ! -z "$OUTPUT" ] if [ ! -z "$OUTPUT" ]
then then
cp $OUT $OUTPUT mv $OUT /tmp/out.smx
cd "$BASEDIR"
mv /tmp/out.smx $OUTPUT
fi fi