scripts/save.game.link

37 lines
1.0 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/sh
# Vars {{{
## Steam {{{
steam_id="112595584"
steam_userdata=".steam/steam/userdata/${steam_id}"
## }}}
remote_dir="${HOME}/Nextcloud/games/linux.sgl.script"
remote_steam_userdata="${remote_dir}/${steam_userdata}"
local_steam_userdata="${HOME}/${steam_userdata}"
# }}}
# Tests {{{
## Ensure remote dir exist {{{
if [ ! -d "${remote_dir}" ]; then
printf '\e[1;35m%-6s\e[m\n' "The directory for save game doesn't exists: ${remote_dir}"
exit 1
fi
## }}}
## Ensure Steam dir exist {{{
if [ ! -d "${local_steam_userdata}" ]; then
printf '\e[1;35m%-6s\e[m\n' "The Steam directory for your ID (${steam_id}) doesn't exists yet… Should it must be create (for restoration,…) [Y/n]?"
read -r create_local_steam_userdata
if [ "${create_local_steam_userdata}" = "" ] || [ "${create_local_steam_userdata}" = "Y" ] || [ "${create_local_steam_userdata}" = "y" ]; then
mkdir -p -- "${local_steam_userdata}"
else
printf '\e[1;35m%-6s\e[m\n' "Steam directory doesn't exists, abort script."
exit 2
fi
fi
## }}}
# }}}