heribertolugo / FileList

List all files in a given directory, and provide the option to copy or move selected files.
1 stars 0 forks source link

Check System Object Accesibility #97

Open heribertolugo opened 2 years ago

heribertolugo commented 2 years ago

at the moment the process for checking if a file or folder is accessible involves enumerating the folders contents/reading the file, and then catching the exception if system object is inaccessible. this results in a huge performance decrease due to

  1. exception being thrown
  2. enumerating contents (sys object acc is checked while enumerating path, which results in multiple iterations of enumeration)

a possible solution is using GetAccessControl as show here: How do you check for permissions to write to a directory or file?

Project: Common File: IoHelper.cs Method: IsSystemObjectAccessable(string path)

heribertolugo commented 2 years ago

seems this check was mostly put in place for corrupt files which cause exception when trying to read or enumerate.

a better solution needs to be implemented.