Skip to content

Commit

Permalink
Merge pull request #381 from Dashboy1998/isWritable-Update-for-NFS
Browse files Browse the repository at this point in the history
Updated isWritable
  • Loading branch information
thijsvanloef authored Feb 21, 2024
2 parents 9c91f76 + 39c586a commit 0f02311
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion scripts/helper_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,17 @@ isReadable() {
isWritable() {
local path="$1"
local return_val=0
if ! [ -w "${path}" ]; then
# Directories may be writable but not deletable causing -w to return false
if [ -d "${path}" ]; then
temp_file=$(mktemp -q -p "${path}")
if [ -n "${temp_file}" ]; then
rm -f "${temp_file}"
else
echo "${path} is not writable."
return_val=1
fi
# If it is a file it must be writable
elif ! [ -w "${path}" ]; then
echo "${path} is not writable."
return_val=1
fi
Expand Down

0 comments on commit 0f02311

Please sign in to comment.