Refactor resource gen script

This commit is contained in:
mkrsym1 2023-07-07 13:59:28 +03:00
parent 351fe85e2f
commit 7a8087e8a1

View File

@ -1,39 +1,37 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# I hate this.
linker="x86_64-w64-mingw32-ld" linker="x86_64-w64-mingw32-ld"
# Output config (terrible) # Select output types
if [ "x$1" = "x--header" ]; then for i in {0..1}
gen_header=1 do
shift case "$1" in
fi --header)
gen_header=1
if [ "x$1" = "x--object" ]; then shift
gen_object=1 ;;
shift --object)
fi gen_object=1
shift
;;
esac
done
# Read project directory # Read project directory
proj_dir=`realpath "$1"` proj_dir=`realpath "$1"`
shift shift
# Read output file destinations # Read output file destinations and make sure they don't exist
if [ "x${gen_object}" = "x1" ]; then if [ "x${gen_object}" = "x1" ]; then
resources_o=`realpath "$1"` resources_o=`realpath "$1"`
shift shift
rm -f "${resources_h}"
fi fi
if [ "x${gen_header}" = "x1" ]; then if [ "x${gen_header}" = "x1" ]; then
resources_h=`realpath "$1"` resources_h=`realpath "$1"`
shift 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}" rm -f "${resources_o}"
fi fi