cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Mfoltz80
Level I

Is directory writable returns 0 when directory is writable

I have an issue that users who previously had read only access to network drives, when provided read write access still cause is directory writable() to return 0 when in the directory, after having been granted access. Users have verified that they can open a folder, make a file, update a file, and delete a file in the directory in question. Anyone else have this issue before. This has made it difficult to set up data validation regarding save directories.
2 REPLIES 2
Craige_Hales
Super User

Re: Is directory writable returns 0 when directory is writable

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 PermissionsUser PermissionsAdmin 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.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
Mfoltz80
Level I

Re: Is directory writable returns 0 when directory is writable

My guess is that your are right. My IT group are likely just updating the first write status for users to be enabled. But jmp may be requiring the second “ancient” field to not be read only ( completely unchecked) when updating user privileges for the is directory writable to return 0. And my IT team doesn’t realize they need to fix that location as well…

Makes sense that it’s not an end to end test through. As they obviously have read-write access.

Have already run the is is directory command ahead to confirm the path is input correctly and exists. And it does return 1. Thanks for suggesting that as an initial sanity check.

I will also ask IT to check the drive mapping for that directory. And will check back if I discover a resolution.

Anyone have a jsl script that does an end to end version of is directory writable that I could sub in for the check that JMP is doing? That might be the better long term fix for this issue…