mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-24 11:16:51 +00:00
config/functions: add safe_remove to notify if a file doesn't exist
This commit is contained in:
parent
c71997a775
commit
4811063c90
@ -129,6 +129,21 @@ build_msg() {
|
||||
fi
|
||||
}
|
||||
|
||||
# prints a warning if the file slated for removal doesn't exist
|
||||
# this allows us to continue instead of bailing out with just "rm"
|
||||
safe_remove() {
|
||||
local path="$1"
|
||||
|
||||
[ -z "${path}" ] && return 0
|
||||
|
||||
if [ -f "${path}" -o -d "${path}" ]; then
|
||||
rm -r "${path}"
|
||||
elif [ -n "${PKG_NAME}" ]; then
|
||||
print_color CLR_WARNING "safe_remove: path does not exist: [${PKG_NAME}]: ${path}\n"
|
||||
else
|
||||
print_color CLR_WARNING "safe_remove: path does not exist: ${path}\n"
|
||||
fi
|
||||
}
|
||||
|
||||
### BUILDSYSTEM HELPERS ###
|
||||
# check if a flag is enabled
|
||||
|
Loading…
x
Reference in New Issue
Block a user