Skip to content

Commit 4edbba3

Browse files
authored
fix/lazyload [1.1.0] (#1)
Fixing unpacking
1 parent adac03b commit 4edbba3

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

lazylosad.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,17 @@ echo "⬇️ Downloading $choice..."
5959
curl -#L -o "$archive" "$url"
6060

6161
echo "📦 Unpacking to $(pwd)..."
62-
unzip -oq "$archive" -d .
62+
unzip -oq "$archive" -d "$tmpdir/unzip"
63+
64+
first_item=$(find "$tmpdir/unzip" -mindepth 1 -maxdepth 1 | head -n 1)
65+
dir_count=$(find "$tmpdir/unzip" -mindepth 1 -maxdepth 1 -type d | wc -l)
66+
67+
shopt -s dotglob
68+
if [[ -d "$first_item" && $dir_count -eq 1 ]]; then
69+
mv "$first_item"/* .
70+
else
71+
mv "$tmpdir/unzip"/* .
72+
fi
73+
shopt -u dotglob
6374

6475
echo "🎉 Done!"

0 commit comments

Comments
 (0)