1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/prestashop_ynh.git synced 2024-09-03 20:06:39 +02:00

Ajouter check_path dans .fonctions

This commit is contained in:
magikcypress 2017-03-12 00:57:49 +01:00
parent 9e7c1e7b10
commit 49f9f334a5

View file

@ -24,6 +24,15 @@ CHECK_FINALPATH () { # Vérifie que le dossier de destination n'est pas déjà u
test ! -e "$final_path" || ynh_die "This path already contains a folder"
}
CHECK_PATH () { # Checks / at the beginning of the path. And his absence at the end.
if [ "${path:0:1}" != "/" ]; then # If the first character is not /
path="/$path" # Add / at the beginning of path
fi
if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then # If the last character is a / and it is not the only character.
path="${path:0:${#path}-1}" # Delete last character
fi
}
#=================================================
# DISPLAYING
#=================================================