bool hasWriteAccessToFolder(string path)
{
bool hasAccess = true;
try
{
path = Path.GetFullPath(path);
Logger.Log(path, LogType.Debug);
FileStream myfile = File.Create(path + "permissiontest.txt");
myfile.Close();
File.Delete(path + "permissiontest.txt");
/*FileIOPermission writePermission = new FileIOPermission(FileIOPermissionAccess.AllAccess, path);
if (!SecurityManager.IsGranted(writePermission))
{
hasAccess = false;
}*/
}
catch (Exception ex)
{
Logger.Log(ex.Message, LogType.Debug);
hasAccess = false;
}
return hasAccess;
}