Guest User

post-launch.sh

a guest
Jun 4th, 2022
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.15 KB | None | 0 0
  1. #!/bin/bash
  2. usage(){
  3.     echo "Usage: $0 "
  4.     echo "This script needs to be run from the base install directory."
  5.     echo "-h for this dialog."
  6. }
  7.  
  8. rmathing(){
  9.     x="$(realpath -s "$1")"
  10.     filex="$(file "$x")"
  11.     if ! [[ "$filex" == *" (No such file or directory)" ]]; then #it exist
  12.         if [[ "$filex" == *": directory" ]]; then #it dir. use dir cmd instead.
  13.             echo "Running: rm -r $x"
  14.             rm -r "$x"
  15.         else
  16.             echo "Running: rm $x"
  17.             rm "$x"
  18.         fi
  19.     fi
  20. }
  21.  
  22. if (( $# >= 0 )); then
  23.     while getopts "h" OPTION; do
  24.         case "${OPTION}" in
  25.             h)
  26.                 usage
  27.                 exit
  28.                 ;;
  29.             \?)
  30.                 exit
  31.                 ;;
  32.         esac
  33.     done
  34.     shift "$(($OPTIND -1))"
  35.  
  36.     cd "$(realpath "$(dirname "$0")")"
  37.     if ! [[ "$PWD" == *"Divinity Original Sin 2" ]]; then #we in wrong dir. abort.
  38.         zenity --info --text="Error with $0:\n\nThere was a problem changing to or verifying the install directory.\nEnsure this script is in the Divinity Original Sin 2 directory.\nDiagnosing and fixing the problem is beyond the abilities of this script.\n\nExiting." --width=250
  39.         echo "ERROR: Wrong dir. Aborting."
  40.         exit
  41.     fi
  42.  
  43.     rmathing ./bin/SupportTool.exe
  44.     rmathing ./bin
  45.     rmathing ./Data
  46.  
  47. else
  48.     usage
  49. fi
Advertisement
Add Comment
Please, Sign In to add comment