Skip to content
This repository has been archived by the owner on Jan 14, 2025. It is now read-only.

Commit

Permalink
Merge pull request #518 from rockerbacon/fix-prefix-library-split
Browse files Browse the repository at this point in the history
Fix installation failure due to incorrect prefix location
  • Loading branch information
rockerbacon authored Aug 17, 2023
2 parents ced3e5d + a813cec commit 7b90f86
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 24 deletions.
16 changes: 3 additions & 13 deletions step/check_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,8 @@ if [ -z "$(command -v curl)" ] && [ -z "$(command -v wget)" ]; then
missing_deps+=("curl or wget")
fi

if [ -z "$(command -v protontricks)" ]; then
if [ -n "$(command -v flatpak)" ]; then
if flatpak info com.github.Matoking.protontricks > /dev/null; then
using_flatpak_protontricks=1
else
missing_deps+=(protontricks)
fi
else
missing_deps+=(protontricks)
fi
else
using_flatpak_protontricks=0
if [ ! $("$utils/protontricks.sh" get-release) ]; then
missing_deps+=(protontricks)
fi

if [ -z "$(command -v zenity)" ]; then
Expand All @@ -42,7 +32,7 @@ fi

os_id=$("$utils/get_os_id.sh")

if [ "$os_id" == "steamos" ] && [ "$using_flatpak_protontricks" == "0" ]; then
if [ "$os_id" == "steamos" ] && [ "$("$utils/protontricks.sh" get-release)" != "flatpak" ]; then
log_error "Using non-flatpak Protontricks on SteamOS"
"$dialog" errorbox \
"Only Flatpak releases of Protontricks are supported on SteamOS.\nPlease install Protontricks through the Discover app and try again."
Expand Down
12 changes: 3 additions & 9 deletions step/configure_steam_wineprefix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,9 @@

if [ -n "${game_protontricks[*]}" ]; then
log_info "applying protontricks ${game_protontricks[@]}"
if [ "$using_flatpak_protontricks" == "0" ]; then
WINETRICKS="$executable_winetricks" \
protontricks "$game_appid" -q "${game_protontricks[@]}" \
| "$dialog" loading "Configuring game prefix\nThis may take a while"
else
flatpak run 'com.github.Matoking.protontricks' \
"$game_appid" -q "${game_protontricks[@]}" \
| "$dialog" loading "Configuring game prefix\nThis may take a while"
fi

"$utils/protontricks.sh" apply "$game_appid" "${game_protontricks[@]}" \
| "$dialog" loading "Configuring game prefix\nThis may take a while"

if [ "$?" != "0" ]; then
"$dialog" errorbox \
Expand Down
4 changes: 2 additions & 2 deletions step/load_gameinfo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if [ ! -d "$steam_library" ]; then
exit 1
fi

game_compatdata="$steam_library/steamapps/compatdata/$game_appid"
game_prefix="$game_compatdata/pfx"
game_prefix=$("$utils/protontricks.sh" get-prefix "$game_appid")
game_compatdata=$(dirname "$game_prefix")
game_installation="$steam_library/steamapps/common/$game_steam_subdirectory"

72 changes: 72 additions & 0 deletions utils/protontricks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/usr/bin/env bash

function log_error() {
echo "ERROR: $@" >&2
}

function get_release() {
if [ -z "$(command -v protontricks)" ]; then
if [ -n "$(command -v flatpak)" ]; then
if flatpak info com.github.Matoking.protontricks &> /dev/null; then
echo "flatpak"
return 0
fi
fi
else
echo "system"
return 0
fi

return 1
}

function do_protontricks() {
release=$(get_release)

case "$release" in
flatpak)
WINETRICKS='' \
flatpak run 'com.github.Matoking.protontricks' "$@"
return $?
;;
system)
protontricks "$@"
return $?
;;
*)
log_error "Protontricks unavailable"
return 1
;;
esac
}

function apply() {
appid=$1; shift
do_protontricks "$appid" -q "$@"
return $?
}

function get_prefix() {
do_protontricks -c 'echo $WINEPREFIX' "$1"
return $?
}

action=$1
shift

case "$action" in
get-prefix)
get_prefix "$1"
;;
get-release)
get_release
;;
apply)
apply "$@"
;;
*)
log_error "invalid action '$action'"
exit 1
;;
esac

0 comments on commit 7b90f86

Please sign in to comment.