[Lazarus] How to create a directory from a path string? (cross-platform needed).
Marco van de Voort
marcov at stack.nl
Fri Mar 18 10:53:25 CET 2011
On Wed, Mar 16, 2011 at 09:39:38AM +0100, Sven Barth wrote:
> > explain.
> >
> > An example, please?
>
> While the others already sent you the correct solution
> ("ForceDirectories") I just wanted to note, that FPC abstracts all those
> file and directory related functions for you. There are for example the
> very low level functions mkdir and rmdir that are part of the System unit.
>
> See here: http://www.freepascal.org/docs-html/rtl/system/mkdir.html
>
> Then there are the functions defined in SysUtils like CreateDir,
> ForceDirectories and RemoveDir.
Note that for some cases, security aware programs (CGI, daemons), you have
to be a bit more careful. A known dangerous case is stuff like
forcedirectories on directory hierarchies where you don't have read
permissions (but you do have "x" permissions) on all levels.
> And recent Delphi versions also include a higher level by introducing
> advanced record types that handle all this:
> http://docwiki.embarcadero.com/VCL/en/IOUtils.TDirectory
Fashion, not function. .NET has everything organized in static classes, and
embacadero wants to look more modern.
I wouldn't call this higher level. It is the same level just in OOP style.
More information about the Lazarus
mailing list