From ea3f09f105515e5f0244ecc6d54ae5f202f23de1 Mon Sep 17 00:00:00 2001 From: Dominik Adrian Grzywak Date: Thu, 14 Nov 2024 15:39:51 +0100 Subject: [PATCH] Let 'compile.sh' compile just a single selected file, instead of compiling the whole directory Bring changes from SourceMod's "compile.sh" --- plugins/compile.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/plugins/compile.sh b/plugins/compile.sh index 68402ba1..622f7e50 100755 --- a/plugins/compile.sh +++ b/plugins/compile.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#!/bin/bash -e +cd "$(dirname "$0")" # AMX Mod X # @@ -11,14 +12,23 @@ test -e compiled || mkdir compiled rm -f temp.txt - -for sourcefile in *.sma -do +if [[ $# -ne 0 ]]; then + for sourcefile in "$@" + do amxxfile="`echo $sourcefile | sed -e 's/\.sma$/.amxx/'`" echo -n "Compiling $sourcefile ..." ./amxxpc $sourcefile -ocompiled/$amxxfile >> temp.txt echo "done" -done + done +else + for sourcefile in *.sma + do + amxxfile="`echo $sourcefile | sed -e 's/\.sma$/.amxx/'`" + echo -n "Compiling $sourcefile ..." + ./amxxpc $sourcefile -ocompiled/$amxxfile >> temp.txt + echo "done" + done +fi less temp.txt rm temp.txt