Detabbed
[AROS.git] / rom / dos / setprogramdir.c
blob7025b44e7efffa32c1a9818f6a543fb11d41a5a1
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Set the home directory for a program (PROGDIR:)
6 Lang: english
7 */
8 #include <aros/debug.h>
10 #include "dos_intern.h"
11 #include <proto/exec.h>
13 /*****************************************************************************
15 NAME */
16 #include <proto/dos.h>
18 AROS_LH1(BPTR, SetProgramDir,
20 /* SYNOPSIS */
21 AROS_LHA(BPTR, lock, D1),
23 /* LOCATION */
24 struct DosLibrary *, DOSBase, 99, Dos)
26 /* FUNCTION
27 This function will set a shared lock on the directory that the
28 current program was loaded from. This can be accessed through
29 the path PROGDIR:. The use of this path is to allow the program
30 to easily access files which are supplied with the program.
32 INPUTS
33 lock - The lock to set as the new program directory. NULL
34 is a valid value.
36 RESULT
37 This function will return the old program directory lock.
39 NOTES
40 This function will not duplicate the lock, so you should not
41 free the lock.
43 EXAMPLE
45 BUGS
47 SEE ALSO
48 GetProgramDir()
50 INTERNALS
52 *****************************************************************************/
54 AROS_LIBFUNC_INIT
56 struct Process *pr;
57 BPTR oldLock;
59 pr = (struct Process *)FindTask(NULL);
61 ASSERT_VALID_PROCESS(pr);
63 oldLock = pr->pr_HomeDir;
64 pr->pr_HomeDir = lock;
66 return oldLock;
68 AROS_LIBFUNC_EXIT
69 } /* SetProgramDir */