I have a class named FolderHelper with a method ReadOnly - the aim is to check whether the specified directory is read-only and return a bool true or false.
public static bool ReadOnly(string path)
{
DirectoryInfo directoryInfo = new DirectoryInfo(path);
if (directoryInfo.Attributes.HasFlag(FileAttributes.ReadOnly))
{
return true;
}
return false;
}
I have set the directory to read-only but the method always returns false - can anyone suggest any reasons why?