5
votes
Vote UpVote

Delphi: do not do “if (not DirectoryExists(path)) then ForceDirectories(path))”

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 ...
Favorite? Off-Topic? jpluimers @ 2013-07-26 13:00

Statistics

Visits: 1878
Votes: 5
Favorites: 1
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

Alister Christie
Chris
Jørn E. Angeltveit
Martijn Coppoolse
Zzzzz
Subscribe:
Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News

Sponsor

 
Please login or register to use this functionality.
(click on this box to dismiss)