1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-15 18:30:08 +00:00

fix(extract): remove extraction file extension for tar (#11873)

This commit is contained in:
Daniel Wang 2023-09-03 23:08:19 +08:00 committed by GitHub
parent 0dc40e88a3
commit 1f56f2bdc4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,6 +30,11 @@ EOF
local file="$1" full_path="${1:A}"
local extract_dir="${1:t:r}"
# Remove the .tar extension if the file name is .tar.*
if [[ $extract_dir =~ '\.tar$' ]]; then
extract_dir="${extract_dir:r}"
fi
# If there's a file or directory with the same name as the archive
# add a random string to the end of the extract directory
if [[ -e "$extract_dir" ]]; then