fix: confirm after auto-finding HD2 path (#51)

This commit is contained in:
v4n
2025-04-17 17:41:56 +03:00
committed by GitHub
parent 649404c2d4
commit ebadc049e7
3 changed files with 35 additions and 10 deletions
+16 -2
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
VERSION="0.5.0"
VERSION="0.5.3"
# --- Globals ---
@@ -194,12 +194,26 @@ function find_game_directory() {
game_dir=$(timeout 10 find "$search_dir" -type d -path "*/$target_dir" 2>/dev/null | head -n 1)
if [[ -z "$game_dir" ]]; then
# if not found, ask user for the directory
log INFO "Could not find the Helldivers 2 data directory automatically."
log PROMPT "Please enter the path to the Helldivers 2 data directory: "
IFS= read -e game_dir
IFS= read -e game_dir; unset IFS
game_dir="$(substitute_home "$game_dir")"
[[ ! -d "$game_dir" ]] && { log ERROR "Provided path is not a valid directory."; exit 1; }
else
# confirm with the user that the directory is ok
log INFO "Found Helldivers 2 data directory: $game_dir"
log PROMPT "Is this the correct directory? (Y/n): "
read confirm
if [[ "$confirm" != "y" && "$confirm" != "Y" && "$confirm" != "" ]]; then
log PROMPT "Please enter the path to the Helldivers 2 data directory: "
IFS= read -e game_dir; unset IFS
game_dir="$(substitute_home "$game_dir")"
[[ ! -d "$game_dir" ]] && { log ERROR "Provided path is not a valid directory."; exit 1; }
fi
fi
# save path