From 7a8087e8a1c74902a0bf6a20c5560e2f33ee7d86 Mon Sep 17 00:00:00 2001 From: mkrsym1 Date: Fri, 7 Jul 2023 13:59:28 +0300 Subject: [PATCH] Refactor resource gen script --- gen_resources.sh | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/gen_resources.sh b/gen_resources.sh index fbdbc3e..8e8a0e6 100644 --- a/gen_resources.sh +++ b/gen_resources.sh @@ -1,39 +1,37 @@ #!/usr/bin/env bash -# I hate this. - linker="x86_64-w64-mingw32-ld" -# Output config (terrible) -if [ "x$1" = "x--header" ]; then - gen_header=1 - shift -fi - -if [ "x$1" = "x--object" ]; then - gen_object=1 - shift -fi +# Select output types +for i in {0..1} +do + case "$1" in + --header) + gen_header=1 + shift + ;; + --object) + gen_object=1 + shift + ;; + esac +done # Read project directory proj_dir=`realpath "$1"` shift -# Read output file destinations +# Read output file destinations and make sure they don't exist if [ "x${gen_object}" = "x1" ]; then resources_o=`realpath "$1"` shift + + rm -f "${resources_h}" fi if [ "x${gen_header}" = "x1" ]; then resources_h=`realpath "$1"` shift -fi -# Make sure that output files do not exist -if [ "x${gen_header}" = "x1" ]; then - rm -f "${resources_h}" -fi -if [ "x${gen_object}" = "x1" ]; then rm -f "${resources_o}" fi