mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
perf: only create dirs if they do not already exist (#1566)
Co-authored-by: Matt Ouellette <mouellette@cainc.com>
This commit is contained in:
parent
2b9bec7710
commit
b6b8074914
4
bin/asdf
4
bin/asdf
@ -1,5 +1,9 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
if [[ "${ASDF_DEBUG}" == "1" ]]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
# shellcheck source=lib/utils.bash
|
# shellcheck source=lib/utils.bash
|
||||||
. "$(dirname "$(dirname "$0")")/lib/utils.bash"
|
. "$(dirname "$(dirname "$0")")/lib/utils.bash"
|
||||||
|
@ -76,7 +76,7 @@ plugin_add_command() {
|
|||||||
local plugin_path
|
local plugin_path
|
||||||
plugin_path=$(get_plugin_path "$plugin_name")
|
plugin_path=$(get_plugin_path "$plugin_name")
|
||||||
|
|
||||||
mkdir -p "$(asdf_data_dir)/plugins"
|
[ -d "$(asdf_data_dir)/plugins" ] || mkdir -p "$(asdf_data_dir)/plugins"
|
||||||
|
|
||||||
if [ -d "$plugin_path" ]; then
|
if [ -d "$plugin_path" ]; then
|
||||||
printf '%s\n' "Plugin named $plugin_name already added"
|
printf '%s\n' "Plugin named $plugin_name already added"
|
||||||
|
@ -62,7 +62,7 @@ get_install_path() {
|
|||||||
local install_dir
|
local install_dir
|
||||||
install_dir="$(asdf_data_dir)/installs"
|
install_dir="$(asdf_data_dir)/installs"
|
||||||
|
|
||||||
mkdir -p "${install_dir}/${plugin}"
|
[ -d "${install_dir}/${plugin}" ] || mkdir -p "${install_dir}/${plugin}"
|
||||||
|
|
||||||
if [ "$install_type" = "version" ]; then
|
if [ "$install_type" = "version" ]; then
|
||||||
printf "%s/%s/%s\n" "$install_dir" "$plugin" "$version"
|
printf "%s/%s/%s\n" "$install_dir" "$plugin" "$version"
|
||||||
@ -81,7 +81,7 @@ get_download_path() {
|
|||||||
local download_dir
|
local download_dir
|
||||||
download_dir="$(asdf_data_dir)/downloads"
|
download_dir="$(asdf_data_dir)/downloads"
|
||||||
|
|
||||||
mkdir -p "${download_dir}/${plugin}"
|
[ -d "${download_dir}/${plugin}" ] || mkdir -p "${download_dir}/${plugin}"
|
||||||
|
|
||||||
if [ "$install_type" = "version" ]; then
|
if [ "$install_type" = "version" ]; then
|
||||||
printf "%s/%s/%s\n" "$download_dir" "$plugin" "$version"
|
printf "%s/%s/%s\n" "$download_dir" "$plugin" "$version"
|
||||||
@ -442,7 +442,7 @@ initialize_or_update_plugin_repository() {
|
|||||||
git -C "$repository_path" reset --hard origin/master
|
git -C "$repository_path" reset --hard origin/master
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p "$(asdf_data_dir)/tmp"
|
[ -d "$(asdf_data_dir)/tmp" ] || mkdir -p "$(asdf_data_dir)/tmp"
|
||||||
touch "$(asdf_data_dir)/tmp/repo-updated"
|
touch "$(asdf_data_dir)/tmp/repo-updated"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user