From 6e3746e9b499390ab21b072de0896b9d24a4e072 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Mon, 16 Dec 2024 15:21:57 +0900 Subject: [PATCH] fix: abort path discovery --- CHANGELOG.md | 5 +++++ dzgui.sh | 6 +++--- helpers/funcs | 12 ++++++++++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71c19b2..56e0f91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ ## [5.6.0-beta.18] 2024-12-14 ### Added - Open Steam workshop subscriptions +### Fixed +- Empty dialog popups if user manually deletes local mods while application is running +- Abort DayZ path discovery if VDF if Steam files are not synched +### Changed +- Admonish user to restart Steam in error dialog if DayZ path could not be found ## [5.6.0-beta.17] 2024-12-14 ### Added diff --git a/dzgui.sh b/dzgui.sh index a7aabc6..05d9cee 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -581,7 +581,7 @@ fetch_helpers_by_sum(){ ["ui.py"]="0e3845ef150ee9863f9160c62dbb24f9" ["query_v2.py"]="55d339ba02512ac69de288eb3be41067" ["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397" - ["funcs"]="4c1480fcfae15c4bc1c02a337d1de488" + ["funcs"]="a9745fa5cc2f007bddf0d30032845fbd" ["lan"]="c62e84ddd1457b71a85ad21da662b9af" ) local author="aclist" @@ -747,7 +747,7 @@ find_library_folder(){ local search_path="$1" steam_path="$(python3 "$helpers_path/vdf2json.py" -i "$1/steamapps/libraryfolders.vdf" \ | jq -r '.libraryfolders[]|select(.apps|has("221100")).path')" - if [[ ! $? -eq 0 ]]; then + if [[ ! $? -eq 0 ]] || [[ -z $steam_path ]]; then logger WARN "Failed to parse Steam path using '$search_path'" return 1 fi @@ -800,7 +800,7 @@ create_config(){ find_library_folder "$default_steam_path" if [[ -z $steam_path ]]; then logger raise_error "Steam path was empty" - zenity --question --text="DayZ not found or not installed at the Steam library given." --ok-label="Choose path manually" --cancel-label="Exit" + zenity --question --text="DayZ not found or not installed at the Steam library given. NOTE: if you recently installed DayZ or moved its location, you MUST restart Steam first for these changes to synch." --ok-label="Choose path manually" --cancel-label="Exit" if [[ $? -eq 0 ]]; then logger INFO "User selected file picker" file_picker diff --git a/helpers/funcs b/helpers/funcs index 1bf3d1a..88bc082 100755 --- a/helpers/funcs +++ b/helpers/funcs @@ -353,12 +353,13 @@ list_mods(){ local name local base_dir local size + local mods if [[ -z $(installed_mods) ]] || [[ -z $(find $workshop_dir -maxdepth 2 -name "*.cpp" | grep .cpp) ]]; then printf "No mods currently installed or incorrect path set." logger WARN "Found no locally installed mods" return 1 else - for dir in $(find $game_dir/* -maxdepth 1 -type l); do + mods=$(for dir in $(find $game_dir/* -maxdepth 1 -type l); do symlink=$(basename $dir) sep="␞" name=$(awk -F\" '/name/ {print $2}' "${dir}/meta.cpp") @@ -366,7 +367,14 @@ list_mods(){ size=$(du -s "$(readlink -f "$game_dir/$symlink")" | awk '{print $1}') size=$(python3 -c "n=($size/1024) +.005; print(round(n,4))") LC_NUMERIC=C printf "%s$sep%s$sep%s$sep%3.3f\n" "$name" "$symlink" "$base_dir" "$size" - done | sort -k1 + done | sort -k1) + # user may have manually pruned mods out-of-band + # handle directory detritus but no actual mods + if [[ -z $mods ]]; then + printf "No mods currently installed or incorrect path set." + return 1 + fi + echo "$mods" fi } installed_mods(){