Search code examples
delphidelphi-11-alexandria

Where can I find System.IO to use FileSystemWatcher on Delphi 11?


I need to monitor real time if a new file is created on a folder. System.IO.FileSystemWatcher seems a perfect solution. But on Delphi 11 it is reporting

[dcc32 Fatal Error] F2613 Unit 'System.IO' not found.

Do I have to download something to have the .pas unit?

P.S. I have explored using the windows API FindFirstChangeNotification but this does not provide the filename created.


Solution

  • System.IO.FileSystemWatcher is a .net class and not part of the Delphi RTL. Therefore you won't find it anywhere.

    I think the API function you need is ReadDirectoryChangesW.