Verify the path exists with IsDirectory() before IsDirectoryWritable(). If the directory does not exist (misspelled, etc), IsDirectoryWritable reports false, not an error. IsDirectory() reports false for a bad name. Possibly a drive mapping issue?
In my quick testing, the function appears to be testing Windows permissions, not actually doing an end-to-end test. For my Linux drives attached to VirtualBox, it always reports true (writable) regardless of the Linux permissions.
Here's what I see:
User PermissionsAdmin Permissions
I'm running as user, not admin, and folders without write permission have isDirectoryWritable==false.
Finally: there is an ancient option that I believe is not involved:
Directories don't really have a read-only attribute.
That square is a third state, neither checked or unchecked.
https://superuser.com/questions/1580751/folders-created-with-read-only-attribute-and-i-cannot-remove
Craige