From 2258643a464dfc5c4188c185fa7defb82f04d7a5 Mon Sep 17 00:00:00 2001 From: vonhyou Date: Mon, 4 Mar 2024 02:57:58 -0500 Subject: [PATCH 1/2] add run script --- run.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 run.sh diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..66ed1f2 --- /dev/null +++ b/run.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# Build the cmake project +cmake -S . -B build +cmake --build build + +# Check if the build was successful +if [ ! -d "build" ]; then + echo "Build directory not found. Build failed." + exit 1 +fi + +# Run the program for each json file in the specified filepath +for jsonfile in "assets"/*.json; do + if [ -f "$jsonfile" ]; then + echo "Processing $jsonfile..." + build/raytracer "$jsonfile" + else + echo "No JSON files found in $FILEPATH." + break + fi +done From e7180edc95e2639a5e808bf17563d6cb6a6f4123 Mon Sep 17 00:00:00 2001 From: vonhyou Date: Mon, 4 Mar 2024 03:01:41 -0500 Subject: [PATCH 2/2] fix logic err --- run.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/run.sh b/run.sh index 66ed1f2..33dfd01 100755 --- a/run.sh +++ b/run.sh @@ -4,7 +4,7 @@ cmake -S . -B build cmake --build build # Check if the build was successful -if [ ! -d "build" ]; then +if [ ! -f "build/raytracer" ]; then echo "Build directory not found. Build failed." exit 1 fi @@ -19,3 +19,5 @@ for jsonfile in "assets"/*.json; do break fi done + +rm -f build/raytracer