Search code examples
windowsfile-permissionslabview

In Labview 2012, Windows 7 OS, how can user write permission be verified?


While developing Labview code for a Windows 7 operating system, it became apparent the system which the software is used may be set up to not allow a common user write access to a selected folder. If the selected folder does not have write permission, the code needs to prompt the user to select a different folder.

So far I have Labview 2012 and found the Get Permissions block under advanced file functions. Is this the best way to determine if a user has write permission? Does a better way exist to test for write permission?


Solution

  • Get Permissions does not return accurate results on Windows.

    I just tried it on some subfolders of C:\Users on my Windows 7 machine and it returns 111111111 (binary) for all user folders - indicating that I should have full read and write access - even though Windows won't actually let me write to any user's folder other than my own.

    Meanwhile C:\Users\Public returns 101101101, implying no write access, but I can write to that folder.

    My understanding of Windows file and folder permissions in a network environment is that it can become very complex, with different policies applied in different places, and the best way to find out if you can write to a location is to try and write there and catch the error.