diff --git a/reset-minetest-install-source.sh b/reset-minetest-install-source.sh index f6a34e3..c88e099 100755 --- a/reset-minetest-install-source.sh +++ b/reset-minetest-install-source.sh @@ -86,23 +86,22 @@ do done cd "$EM_CONFIG_PATH" || customDie "[$MY_NAME] cd \"$EM_CONFIG_PATH\" failed." if [ -d "$extracted_path" ]; then - - # NOTE: ls -lR provides a count, so it is not suitable unless output - # is parsed. `| wc -l` is easier (word count). - screenshot_count=0 - if [ -d $extracted_path/screenshots ]; then - screenshot_count=`ls $extracted_path/screenshots/*.png | wc -l` - fi - if [ $screenshot_count -gt 0 ]; then - mv $extracted_path/screenshots/*.png ~/ || customDie "can't move screenshots from $extracted_path/screenshots/*.png" - rmdir --ignore-fail-on-non-empty "$extracted_path/screenshots" - fi - if [ `ls $extracted_path/minetest/bin/*.png | wc -l` -gt 0 ]; then - # if [ ! -d screenshots ]; then mkdir screenshots; fi - # NOTE: system-wide install of minetest puts screenshots in ~/ (cwd) - mv $extracted_path/minetest/bin/*.png ~/ || customDie "can't move screenshots from $extracted_path/minetest/bin/*.png" - fi - rm -Rf "$extracted_path" || customDie "can't remove $extracted_name" + # NOTE: ls -lR provides a count, so it is not suitable unless output + # is parsed. `| wc -l` is easier (word count). + screenshot_count=0 + if [ -d $extracted_path/screenshots ]; then + screenshot_count=`ls $extracted_path/screenshots/*.png | wc -l` + fi + if [ $screenshot_count -gt 0 ]; then + mv $extracted_path/screenshots/*.png ~/ || customDie "can't move screenshots from $extracted_path/screenshots/*.png" + rmdir --ignore-fail-on-non-empty "$extracted_path/screenshots" + fi + if [ `ls $extracted_path/minetest/bin/*.png | wc -l` -gt 0 ]; then + # if [ ! -d screenshots ]; then mkdir screenshots; fi + # NOTE: system-wide install of minetest puts screenshots in ~/ (cwd) + mv $extracted_path/minetest/bin/*.png ~/ || customDie "can't move screenshots from $extracted_path/minetest/bin/*.png" + fi + rm -Rf "$extracted_path" || customDie "can't remove $extracted_name" fi if [ "@$enable_offline" = "@true" ]; then