When launching the script, actually source the right things.

If I try to launch it via
~/projects/audiogame-manager/audiogame-manager.sh it will crap out
because it isn't able to source its include files; it erroneously
thinks they're in the current directory as I am, which is no exactly
true unless I physically go to the audiogame manager directory. This
also fixes launching from the desktop icon.
This commit is contained in:
2025-11-04 18:01:49 -05:00
parent fe50e2be3e
commit 6fe5e4fa17
2 changed files with 21 additions and 17 deletions

View File

@@ -235,7 +235,7 @@ game_installer() {
# remove games
game_removal() {
source .includes/bottle.sh
source "${scriptDir}/.includes/bottle.sh"
# Modern wine is unified - no architecture-specific wine executables needed
mapfile -t lines < <(sed -e '/^$/d' -e '/^[[:space:]]*#/d' "${configFile}" 2> /dev/null)
if [[ ${#lines} -eq 0 ]]; then
@@ -273,7 +273,7 @@ game_removal() {
create_game_array "$selectedGame"
if [[ ${#game[@]} -gt 0 ]]; then
# Set up wine environment for this game
source .includes/bottle.sh
source "${scriptDir}/.includes/bottle.sh"
get_bottle "${game[0]}"
if ! agm_yesno "Confirm Removal" "Audio Game Removal" "Are you sure you want to remove \"${game[2]}\"?"; then
@@ -303,7 +303,7 @@ game_removal() {
# kill games that are stuck
kill_game() {
source .includes/bottle.sh
source "${scriptDir}/.includes/bottle.sh"
# Modern wine is unified - no architecture-specific wine executables needed
mapfile -t lines < <(sed '/^$/d' "${configFile}" 2> /dev/null)
if [[ ${#lines} -eq 0 ]]; then
@@ -447,7 +447,7 @@ create_game_array() {
# Update NVDA controller client DLLs in wine bottles
update_nvda_dlls() {
# Ensure we have the replacement DLLs
source .includes/functions.sh
source "${scriptDir}/.includes/functions.sh"
download "${nvdaControllerClientDll}" "${nvdaControllerClient64Dll}"
# Update wine64 bottle (most common)
@@ -493,7 +493,7 @@ update_nvda_dlls() {
game_launcher() {
# For use by update scripts that want to source functions in this file.
[[ "$agmNoLaunch" == "true" ]] && return
source .includes/bottle.sh
source "${scriptDir}/.includes/bottle.sh"
# Start nvda2speechd if available
if [[ -x ${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd ]]; then
@@ -522,7 +522,7 @@ game_launcher() {
if [[ $menuCode -eq 1 ]] || [[ $menuCode -eq 255 ]]; then
exit 0
elif [[ $menuCode -eq 3 ]]; then
source .includes/help.sh # Make available in this function
source "${scriptDir}/.includes/help.sh" # Make available in this function
documentation "$game" "$(echo "$game" | cut -d '|' -f2)"
fi
@@ -588,7 +588,7 @@ else
fi
# Source dialog interface early for progress display
source .includes/dialog-interface.sh
source "${scriptDir}/.includes/dialog-interface.sh"
# If display isn't set assume we are launching from console and an X environment is running using display :0
if [[ -z "$DISPLAY" ]]; then
@@ -633,12 +633,12 @@ export nvda2speechdBinary="${ipfsGateway}/ipfs/QmPxhoNsoFoJC7bCfioBBCcK8tEoSoYpm
# Source helper functions
source .includes/bottle.sh # Also sourced in functions that need it
source .includes/desktop.sh
source "${scriptDir}/.includes/bottle.sh" # Also sourced in functions that need it
source "${scriptDir}/.includes/desktop.sh"
# dialog-interface.sh already sourced earlier
source .includes/functions.sh
source .includes/help.sh
source .includes/update.sh
source "${scriptDir}/.includes/functions.sh"
source "${scriptDir}/.includes/help.sh"
source "${scriptDir}/.includes/update.sh"
# Check minimum requirements
check_requirements || exit 1
@@ -685,7 +685,7 @@ args="${!command[*]}"
args="${args//[[:space:]]/}"
while getopts "${args}" i ; do
case "$i" in
c) ./.includes/checkup.sh;;
c) "${scriptDir}/.includes/checkup.sh";;
C) clear_cache;;
D) desktop_launcher;;
d)
@@ -711,7 +711,7 @@ while getopts "${args}" i ; do
r) game_removal;;
S) defaultRate="${OPTARG}";;
t)
gameCount=$(find ".install" -type f -iname "*.sh" | wc -l)
gameCount=$(find "${scriptDir}/.install" -type f -iname "*.sh" | wc -l)
agm_infobox "Linux Game Manager" "Linux Game Manager" "There are currently ${gameCount} games available."
exit 0
;;
@@ -729,9 +729,9 @@ if [[ "$noninteractiveInstall" == "true" ]]; then
[[ ${#game} -lt 1 ]] && exit 0
# Install the specified game noninteractively
if [[ -f ".install/${game}.sh" ]]; then
if [[ -f "${scriptDir}/.install/${game}.sh" ]]; then
export LANG="en_US.UTF-8"
. ".install/${game}.sh"
. "${scriptDir}/.install/${game}.sh"
# Show success message
agm_msgbox "Installation Complete" "Audio Game Installer" "Game \"${game}\" has been successfully installed."
else