peteraritchie / LongPath

drop-in library to support long paths in .NET
GNU Lesser General Public License v3.0
112 stars 43 forks source link

File Security not working #40

Closed nathansantanna closed 8 years ago

nathansantanna commented 8 years ago

Im trying to set acl programatically, but "File.SetAccessControl(string path, FileSecurity FileSecurity)"didn't work, "File.GetAccessControl(string path)" worked fine!

;

nathansantanna commented 8 years ago

Sorry, i think i was using an old version, I downloaded the repository, and now is working fine

peteraritchie commented 8 years ago

@nathansantanna I believe the latest changes (updated in NuGet) fixes your issue. Please let me know if it did or not. Thanks

nathansantanna commented 8 years ago

Worked perfectly thanks !

nathansantanna commented 8 years ago

But now, i'm having some problems on
Directory.SetAccessControl(string Path, DirectorySecurity directorySecurity ) File.SetAccessControl(string Path, FileSecurity fileSecurity )

doesn't adds the rule on my folder or file, with System.IO works fine.

Here's how i'm using. public void RemoveFileSecurity(FileSystemAccessRule rule) { FileSecurity fileSecurity = File.GetAccessControl(Path); fileSecurity.RemoveAccessRule(rule); System.IO.File.SetAccessControl(Path, fileSecurity); }

thanks in advance!