From a0156923094ee4f1f811e7b52307fa3ec2e93786 Mon Sep 17 00:00:00 2001 From: Shorohov Sergey Date: Fri, 6 Sep 2019 15:25:07 +0300 Subject: [PATCH] Update compile.sh - Add ability to compile multiple files thru args --- plugins/compile.sh | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/plugins/compile.sh b/plugins/compile.sh index 68402ba1..1a35f6e9 100755 --- a/plugins/compile.sh +++ b/plugins/compile.sh @@ -1,24 +1,20 @@ -#!/bin/bash - -# AMX Mod X -# -# by the AMX Mod X Development Team -# originally developed by OLO -# -# This file is part of AMX Mod X. - -# new code contributed by \malex\ +#!/bin/bash -e +cd "$(dirname "$0")" test -e compiled || mkdir compiled -rm -f temp.txt -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 - -less temp.txt -rm temp.txt +if [[ $# -ne 0 ]]; then + for sourcefile in "$@" + do + amxxfile="`echo $sourcefile | sed -e 's/\.sma$/\.amxx/'`" + echo -e "\nCompiling $sourcefile..." + ./amxxpc $sourcefile -ocompiled/$amxxfile + done +else + for sourcefile in *.sma + do + amxxfile="`echo $sourcefile | sed -e 's/\.sma$/\.amxx/'`" + echo -e "\nCompiling $sourcefile ..." + ./amxxpc $sourcefile -ocompiled/$amxxfile + done +fi