Check for empty parameters

This commit is contained in:
LinuxSquare 2025-04-10 22:02:59 +02:00
parent c588eae642
commit 551ac17896

View file

@ -111,12 +111,20 @@ function populateConfig() {
}
function checkBackupDir() {
if [[ -z "$1" ]]; then {
log e "Parameters can't be empty!"
exit 1
}
if [[ ! -d "$(getValueByKey 'PODMAN_DIRECTORY')/${1}/backup" ]]; then
mkdir -p "$(getValueByKey 'PODMAN_DIRECTORY')/${1}/backup"
fi
}
function checkDatapackDir() {
if [[ -z "$1" ]]; then {
log e "Parameters can't be empty!"
exit 1
}
if [[ ! -d "$(getValueByKey 'PODMAN_DIRECTORY')/${1}/data/world/datapacks" ]]; then
mkdir -p "$(getValueByKey 'PODMAN_DIRECTORY')/${1}/data/world/datapacks"
fi