From 45c1cf7f72f5b1b4225395f916aaba8d8401c411 Mon Sep 17 00:00:00 2001 From: kiwixz Date: Sun, 22 Jan 2023 00:24:23 +0100 Subject: [PATCH] Fix qcsrc genmod.sh including files twice --- qcsrc/common/minigames/_mod.inc | 6 ++--- qcsrc/common/minigames/_mod.qh | 6 ++--- .../common/mutators/mutator/instagib/_mod.inc | 2 +- .../common/mutators/mutator/instagib/_mod.qh | 2 +- qcsrc/tools/genmod.sh | 27 +++++++++---------- 5 files changed, 20 insertions(+), 23 deletions(-) diff --git a/qcsrc/common/minigames/_mod.inc b/qcsrc/common/minigames/_mod.inc index 4171f475c..a4cd98154 100644 --- a/qcsrc/common/minigames/_mod.inc +++ b/qcsrc/common/minigames/_mod.inc @@ -1,7 +1,4 @@ // generated file; do not modify -#ifdef CSQC - #include -#endif #include #ifdef CSQC #include @@ -9,5 +6,8 @@ #ifdef SVQC #include #endif +#ifdef CSQC + #include +#endif #include diff --git a/qcsrc/common/minigames/_mod.qh b/qcsrc/common/minigames/_mod.qh index e0daf8f67..c74ca54a1 100644 --- a/qcsrc/common/minigames/_mod.qh +++ b/qcsrc/common/minigames/_mod.qh @@ -1,7 +1,4 @@ // generated file; do not modify -#ifdef CSQC - #include -#endif #include #ifdef CSQC #include @@ -9,5 +6,8 @@ #ifdef SVQC #include #endif +#ifdef CSQC + #include +#endif #include diff --git a/qcsrc/common/mutators/mutator/instagib/_mod.inc b/qcsrc/common/mutators/mutator/instagib/_mod.inc index 2195111f0..273779aa7 100644 --- a/qcsrc/common/mutators/mutator/instagib/_mod.inc +++ b/qcsrc/common/mutators/mutator/instagib/_mod.inc @@ -1,5 +1,5 @@ // generated file; do not modify -#include #ifdef SVQC #include #endif +#include diff --git a/qcsrc/common/mutators/mutator/instagib/_mod.qh b/qcsrc/common/mutators/mutator/instagib/_mod.qh index 7097eaf39..f799c5679 100644 --- a/qcsrc/common/mutators/mutator/instagib/_mod.qh +++ b/qcsrc/common/mutators/mutator/instagib/_mod.qh @@ -1,5 +1,5 @@ // generated file; do not modify -#include #ifdef SVQC #include #endif +#include diff --git a/qcsrc/tools/genmod.sh b/qcsrc/tools/genmod.sh index a8dd08de5..dc085018e 100755 --- a/qcsrc/tools/genmod.sh +++ b/qcsrc/tools/genmod.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash set -eu +export LC_ALL=C.UTF-8 + # This script creates / updates the _mod.qc / _mod.qh / _mod.inc files based on # the qc / qh files present in the qcsrc folder. @@ -27,21 +29,16 @@ function genmod() { fi echo '// generated file; do not modify' > ${MOD}.inc echo '// generated file; do not modify' > ${MOD}.qh - for f in $(ls | sort -k 1,1 -t .); do - if [[ "$f" == cl_* ]]; then f="${f#cl_}"; if [[ -f "$f" ]]; then continue; fi - elif [[ "$f" == sv_* ]]; then f="${f#sv_}"; if [[ -f "$f" ]]; then continue; fi - elif [[ "$f" == ui_* ]]; then f="${f#ui_}"; if [[ -f "$f" ]]; then continue; fi - fi - if [[ "$f" == *.qc ]]; then - if [[ -f "$f" ]]; then echo -e "#include <${CTX}$f>" >> ${MOD}.inc; fi - if [[ -f "${f%.qc}.qh" ]]; then echo -e "#include <${CTX}${f%.qc}.qh>" >> ${MOD}.qh; fi - if [[ -f "cl_$f" ]]; then echo -e "#ifdef CSQC\n #include <${CTX}cl_$f>\n#endif" >> ${MOD}.inc; fi - if [[ -f "cl_${f%.qc}.qh" ]]; then echo -e "#ifdef CSQC\n #include <${CTX}cl_${f%.qc}.qh>\n#endif" >> ${MOD}.qh; fi - if [[ -f "sv_$f" ]]; then echo -e "#ifdef SVQC\n #include <${CTX}sv_$f>\n#endif" >> ${MOD}.inc; fi - if [[ -f "sv_${f%.qc}.qh" ]]; then echo -e "#ifdef SVQC\n #include <${CTX}sv_${f%.qc}.qh>\n#endif" >> ${MOD}.qh; fi - if [[ -f "ui_$f" ]]; then echo -e "#ifdef MENUQC\n #include <${CTX}ui_$f>\n#endif" >> ${MOD}.inc; fi - if [[ -f "ui_${f%.qc}.qh" ]]; then echo -e "#ifdef MENUQC\n #include <${CTX}ui_${f%.qc}.qh>\n#endif" >> ${MOD}.qh; fi - fi + for f in $(ls | sed -e "s/^cl_//" -e "s/^sv_//" -e "s/^ui_//" | sort -u); do + if [[ "$f" != *.qc ]]; then continue; fi + if [[ -f "$f" ]]; then echo -e "#include <${CTX}$f>" >> ${MOD}.inc; fi + if [[ -f "${f%.qc}.qh" ]]; then echo -e "#include <${CTX}${f%.qc}.qh>" >> ${MOD}.qh; fi + if [[ -f "cl_$f" ]]; then echo -e "#ifdef CSQC\n #include <${CTX}cl_$f>\n#endif" >> ${MOD}.inc; fi + if [[ -f "cl_${f%.qc}.qh" ]]; then echo -e "#ifdef CSQC\n #include <${CTX}cl_${f%.qc}.qh>\n#endif" >> ${MOD}.qh; fi + if [[ -f "sv_$f" ]]; then echo -e "#ifdef SVQC\n #include <${CTX}sv_$f>\n#endif" >> ${MOD}.inc; fi + if [[ -f "sv_${f%.qc}.qh" ]]; then echo -e "#ifdef SVQC\n #include <${CTX}sv_${f%.qc}.qh>\n#endif" >> ${MOD}.qh; fi + if [[ -f "ui_$f" ]]; then echo -e "#ifdef MENUQC\n #include <${CTX}ui_$f>\n#endif" >> ${MOD}.inc; fi + if [[ -f "ui_${f%.qc}.qh" ]]; then echo -e "#ifdef MENUQC\n #include <${CTX}ui_${f%.qc}.qh>\n#endif" >> ${MOD}.qh; fi done declare -l rec=1 if [[ -f "_all.inc" ]]; then rec=0; fi -- 2.39.2