From ce1aca85b17e23c3be5aa563aac3d3a7fd5d0eb4 Mon Sep 17 00:00:00 2001 From: Bryson Steck Date: Sat, 4 Jun 2022 16:57:31 -0600 Subject: add check if file exists before passing to wit --- README.md | 2 +- patch_iso.sh | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 626f5b4..16b3820 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ You need three things before starting: 3. The Riibalanced Patch Archive (This can be downloaded via the Riibalanced Discord Server) After that, clone the repository and run the script: -``` +```bash git clone https://github.com/brysonsteck/riibalanced-patcher.git cd riibalanced-patcher ./patch_iso.sh diff --git a/patch_iso.sh b/patch_iso.sh index b46c9ca..7aff938 100755 --- a/patch_iso.sh +++ b/patch_iso.sh @@ -98,7 +98,14 @@ fi if [[ ! $1 ]]; then echo "ERROR: Please start this script with the path to the Mario Kart Wii ISO image to start the patch." echo "example: ./patch_iso.sh image/RMCE01.wbfs" - exit 0 + exit 7 +fi + +# check if image exists --------------------------------------------------------- + +if [[ ! -f "$1" ]]; then + echo "ERROR: The file specified does not exist." + exit 8 fi # check for previous image extraction ------------------------------------------- @@ -116,7 +123,7 @@ wit extract $1 RMCE01 ERROR="$?" if [[ ERROR -ne 0 ]]; then - echo "ERROR: wit has returned non-zero exit code $ERROR. Please check that your image is in the specified location and the image is authentic and valid." + echo "ERROR: wit has returned non-zero exit code $ERROR. Please check that your disc image is authentic and valid." exit $ERROR fi -- cgit v1.2.3