The reason why I'm asking this is because .NET sees a folder as ReadOnly if any of the underlying files or folders are ReadOnly. Therefor this code:
if (!Properties.Settings.Default.searchReadOnly &&
(diPath.Attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
writeable = false;
is always going to set writeable to false.
This is a problem if you need to know if the root folder is ReadOnly. The My Docments folder is not ReadOnly, but this is what's shown in the properties window:
Any help would be appreciated.
EDIT
I tried to approach you suggested, but Documents still appears to have the ReadOnly flag set.
if (!Properties.Settings.Default.searchReadOnly &&
diPath.Attributes.HasFlag(FileAttributes.ReadOnly)) // == true
searchable = false;
How is this possible? What user is executing the code? I assume the actively logged in user? Again, assuming because I can write to the Documents folder, it can't have the ReadOnly flag set.