in reply to -w $path Cross Platform Issues

Or am I better off just attempting to write a file in the $path and check for errors?

You're better off just trying to write, because -w checks for permissions, not for locks