#!/bin/bash # Get the XDG data home or default if not set, then append a 'soniccd' folder. data_folder="${XDG_DATA_HOME:-${HOME}/.local/share}/soniccd" # Check if it exists, if not, create it and exit with error code 1. if [[ ! -d "$data_folder" ]]; then mkdir -p "$data_folder" echo "Created data folder in '$data_folder', please copy the game's data" \ "files there and run this launcher again." exit 1 fi # Check if the user forgot to copy data files, if not exit with error code 1. # # If we don't do this check, the game will still create the settings and save # files, but not run (nor set an error code), which can be confusing to the # end user. if [[ -z "$(ls -A $data_folder)" ]]; then echo "Data folder appears to be empty, please copy the game's data files" \ "and run this launcher again." exit 1 fi cd "$data_folder" /usr/bin/soniccd