0

I'm writing a function to check important settings in the program.

Among other things I would like to check if I have read and write access to a folder.

Is there any way to check this with Delphi?

Andreas Rejbrand
  • 105,602
  • 8
  • 282
  • 384
Handas
  • 33
  • 1
  • 8

1 Answers1

1

The simplest way to check if your application has write access to a folder is to try to create a new file and check for error code. No error means you have write access. If creation succeeded, delete the file and check for error (You may have permission to create a file, write to it but not to delete it).

If you prefer to use the more complex way, see the answers to this question.

fpiette
  • 11,983
  • 1
  • 24
  • 46
  • Write permission doesn't imply delete permission tho. Also access wise there's a difference between [appending and overwriting file data](https://learn.microsoft.com/en-us/windows/win32/fileio/file-access-rights-constants). – AmigoJack Jan 23 '21 at 12:22