Moved sdv-manager to sdv-mods and fixed a few bugs.

in-use
Emily Frost 7 years ago
parent cea6bc803a
commit 4d7420f7b3
No known key found for this signature in database
GPG Key ID: FD1FA524668FB1FA

@ -1,11 +1,10 @@
#!/bin/bash
### Manage Stardew Valley mods
# sdv-mods
### Manage Stardew Valley mods with nginx-style x-available and x-enabled folders.
# Use nginx-style mods-available and mods-enabled folders.
# game_dir="${HOME}/.local/share/Steam/steamapps/common/Stardew Valley"
game_dir="${HOME}/sdv-manager-test"
game_dir="${HOME}/.local/share/Steam/steamapps/common/Stardew Valley"
mods_available_dir="${game_dir}/mods-available"
mods_enabled_dir="${game_dir}/mods-enabled"
declare -A mod_state
@ -19,8 +18,7 @@ function get_mod_state {
# TODO: Probably remove broken links and untracked files.
for enabled_mod_dir in "$mods_enabled_dir"/*; do
enabled_mod_name="$(basename "$enabled_mod_dir")"
# xargs sometimes gets a broken pipe signal here. It's harmless but annoying.
if echo "${!mod_state[@]}" | xargs -n1 2>/dev/null | grep -q "$enabled_mod_name"; then
if printf '%s\n' "${!mod_state[@]}" | grep -qx "${enabled_mod_name}"; then
mod_state[$enabled_mod_name]='enabled'
fi
done
@ -31,7 +29,8 @@ function mod_is_available {
get_mod_state
if [[ $mod_name == '' ]]; then
echo "Mod name not given."
elif echo "${!mod_state[@]}" | xargs -n1 2>/dev/null | grep -q "$mod_name"; then
return 1
elif printf '%s\n' "${!mod_state[@]}" | grep -qx "$mod_name"; then
return 0
else
return 1
Loading…
Cancel
Save