2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Get the name of the current directory.
8 #include <proto/exec.h>
10 #include "dos_intern.h"
13 /*****************************************************************************
16 #include <proto/dos.h>
18 AROS_LH2(BOOL
, GetCurrentDirName
,
21 AROS_LHA(STRPTR
, buf
, D1
),
22 AROS_LHA(LONG
, len
, D2
),
25 struct DosLibrary
*, DOSBase
, 94, Dos
)
28 Copies the name of the current directory from the CLI structure
29 into the buffer. If the buffer is too small the name is truncated,
30 and a failure is returned. If the current process doesn't have
31 a CLI structure, a 0 length string is put into the buffer and a
35 buf - Buffer for the name.
36 len - Size of the buffer in bytes.
39 !=0 on success, 0 on failure. IoErr() gives additional information
43 Documented as returning ERROR_OBJECT_WRONG_TYPE if CLI structure
44 is not present but actually it fallbacks to NameFromLock().
55 *****************************************************************************/
59 struct Process
*me
= (struct Process
*)FindTask(NULL
);
60 struct CommandLineInterface
*cli
= BADDR(me
->pr_CLI
);
66 return NameFromLock(me
->pr_CurrentDir
, buf
, len
);
68 cname
= AROS_BSTR_ADDR(cli
->cli_SetName
);
69 clen
= (ULONG
)AROS_BSTR_strlen(cli
->cli_SetName
);
73 me
->pr_Result2
= ERROR_LINE_TOO_LONG
;
76 CopyMem(cname
, buf
, clen
);
81 } /* GetCurrentDirName */