24 lines
		
	
	
		
			955 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			955 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| check_dependencies() {
 | |
|     if [[ $# -lt 2 ]]; then
 | |
|          dialog --backtitle "Linux Game Manager" \
 | |
|                 --msgbox "Invalid call to check_dependencies(). Please check your code." -1 -1 --stdout
 | |
|         exit 1
 | |
|     fi
 | |
|     local packagePath="$1" # Path where the launcher will attempt the package, e.g. ${gamePath/Addons/PACKAGENAME/something.pk3
 | |
|     local packageURL="$2" # URL where the package can be downloaded.
 | |
|     shift 2
 | |
|     if [[ -e "${packagePath}" ]]; then
 | |
|         return
 | |
|     fi
 | |
|     local message=(
 | |
|         "You are missing the \"${packagePath##/*}\" Package." $'\n'
 | |
|         "You can get it from \"${packageURL}\"" $'\n')
 | |
|     echo "${packageURL}" | DISPLAY="${DISPLAY:-:0}" xclip -selection clipboard && message+=("The URL has been copied to the clipboard." $'\n')
 | |
|     for i in "${@}" ; do
 | |
|         message+=("$i" $'\n')
 | |
|     done
 | |
|     dialog --backtitle "Linux Game Manager" \
 | |
|         --msgbox "${message[*]}" -1 -1 --stdout
 | |
|     exit 1
 | |
| }
 |