diff --git a/NonSteamLaunchers.sh b/NonSteamLaunchers.sh index 7746c48..693365c 100644 --- a/NonSteamLaunchers.sh +++ b/NonSteamLaunchers.sh @@ -1613,57 +1613,47 @@ if [[ $options == *"Battle.net"* ]]; then # Check if Battlenet Launcher is installed if [[ ! -f "$battlenet_path1" ]] && [[ ! -f "$battlenet_path2" ]]; then - # Set the appid for the Battlenet Launcher - if [ "$use_separate_appids" = true ]; then - appid=Battle.netLauncher - else - appid=NonSteamLaunchers - fi - # Create app id folder in compatdata folder if it doesn't exist - if [ ! -d "$HOME/.local/share/Steam/steamapps/compatdata/$appid" ]; then - mkdir -p "$HOME/.local/share/Steam/steamapps/compatdata/$appid" - fi - # Change working directory to Proton's - cd $proton_dir + # Set the appid for the Battlenet Launcher + if [ "$use_separate_appids" = true ]; then + appid=Battle.netLauncher + else + appid=NonSteamLaunchers + fi - # Set the STEAM_COMPAT_CLIENT_INSTALL_PATH environment variable - export STEAM_COMPAT_CLIENT_INSTALL_PATH="~/.local/share/Steam" + # Create app id folder in compatdata folder if it doesn't exist + if [ ! -d "$HOME/.local/share/Steam/steamapps/compatdata/$appid" ]; then + mkdir -p "$HOME/.local/share/Steam/steamapps/compatdata/$appid" + fi - # Set the STEAM_COMPAT_DATA_PATH environment variable for Epic Games Launcher - export STEAM_COMPAT_DATA_PATH=~/.local/share/Steam/steamapps/compatdata/$appid + # Change working directory to Proton's + cd $proton_dir - # Download BATTLE file - if [ ! -f "$battle_file" ]; then - echo "Downloading BATTLE file" - wget $battle_url -O $battle_file - fi + # Set the STEAM_COMPAT_CLIENT_INSTALL_PATH environment variable + export STEAM_COMPAT_CLIENT_INSTALL_PATH="~/.local/share/Steam" - # Run the BATTLE file using Proton with the /passive option - echo "Running BATTLE file using Proton with the /passive option" - "$STEAM_RUNTIME" "$proton_dir/proton" run "$battle_file" Battle.net-Setup.exe --lang=enUS --installpath="C:\Program Files (x86)\Battle.net" & + # Set the STEAM_COMPAT_DATA_PATH environment variable for Epic Games Launcher + export STEAM_COMPAT_DATA_PATH=~/.local/share/Steam/steamapps/compatdata/$appid - # Add a counter variable to track the number of times the loop runs - counter=0 - while true; do - if pgrep -f "Battle.net.exe" > /dev/null; then - pkill -f "Battle.net.exe" - break - fi + # Download BATTLE file + if [ ! -f "$battle_file" ]; then + echo "Downloading BATTLE file" + wget $battle_url -O $battle_file + fi - # Increment the counter variable each time the loop runs - ((counter++)) + # Run the BATTLE file using Proton with the /passive option + echo "Running BATTLE file using Proton with the /passive option" + "$STEAM_RUNTIME" "$proton_dir/proton" run "$battle_file" Battle.net-Setup.exe --lang=enUS --installpath="C:\Program Files (x86)\Battle.net" & - # Check if the counter has reached a certain value and exit the loop if it has - if [[ $counter -ge 60 ]]; then - echo "Timeout: Battle.net.exe process not found after 60 seconds" - break - fi - - sleep 1 - done + while true; do + if pgrep -f "Battle.net.exe" > /dev/null; then + pkill -f "Battle.net.exe" + break + fi + sleep 1 +done fi fi