The Wiert Corner – During code reviews, I often see people do things like this: if (not DirectoryExists(Path)) then ForceDirectories(Path)) or this: if (not TDirectory.Exists(Path)) then TDirectory.CreateDirectory((Path)) Half a year ago, I wrote about .NET/C#: do not do “if (!Directory.Exists(path)) Directory.CreateDirectory(path))”. The same holds for since Delphi XE introduced the ForceDirectories method in the SysUtils and FileCtrl units and the TDirectory.CreateDirectory method in the IOUtils unit. You don’t need the if statements here in Delphi either: The methods ForceDirectories and ...
Visits by Source
Users who voted for this posting
Jørn E. Angeltveit