2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
5 Desc: Create a new directory.
9 #include <exec/memory.h>
10 #include <proto/exec.h>
11 #include <utility/tagitem.h>
13 #include <dos/filesystem.h>
14 #include <proto/dos.h>
15 #include <proto/utility.h>
16 #include "dos_intern.h"
18 /*****************************************************************************
21 #include <proto/dos.h>
23 AROS_LH1(BPTR
, CreateDir
,
26 AROS_LHA(CONST_STRPTR
, name
, D1
),
29 struct DosLibrary
*, DOSBase
, 20, Dos
)
32 Creates a new directory under the given name. If all went well, an
33 exclusive lock on the new diretory is returned.
36 name -- NUL terminated name.
39 Exclusive lock to the new directory or 0 if it couldn't be created.
40 IoErr() gives additional information in that case.
52 *****************************************************************************/
56 struct FileHandle
*fh
;
57 struct IOFileSys iofs
;
59 if ((fh
= (struct FileHandle
*) AllocDosObject(DOS_FILEHANDLE
, NULL
)) == NULL
)
62 InitIOFS(&iofs
, FSA_CREATE_DIR
, DOSBase
);
63 iofs
.io_Union
.io_CREATE_DIR
.io_Protection
= 0;
65 if (DoIOFS(&iofs
, NULL
, name
, DOSBase
) != 0) {
66 FreeDosObject(DOS_FILEHANDLE
, fh
);
70 fh
->fh_Device
= iofs
.IOFS
.io_Device
;
71 fh
->fh_Unit
= iofs
.IOFS
.io_Unit
;