Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / nonvolatile / nvdisk / deletenvddata.c
blobe5197436ffc26a368609410f657435e9c10787c7
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 /*****************************************************************************
11 NAME */
13 #include <aros/debug.h>
15 #include "nvdisk_intern.h"
17 #include <dos/dos.h>
18 #include <proto/dos.h>
19 #include <libraries/nonvolatile.h>
21 //static int cxbug; /* For cxref bug */
23 AROS_LH2(BOOL, DeleteNVDData,
25 /* SYNOPSIS */
27 AROS_LHA(STRPTR, appName, A0),
28 AROS_LHA(STRPTR, itemName, A1),
30 /* LOCATION */
32 struct Library *, nvdBase, 7, NVDisk)
34 /* FUNCTION
36 Delete a piece of data in the nonvolatile memory.
38 INPUTS
40 appName -- the application owning the data to be deleted
41 itemName -- name of the data to be deleted
43 RESULT
45 Success / failure indicator.
47 NOTES
49 EXAMPLE
51 BUGS
53 SEE ALSO
55 nonvolatile.library/DeleteNV()
57 INTERNALS
59 HISTORY
61 November 2000, SDuvan -- implemented
63 ******************************************************************************/
66 AROS_LIBFUNC_INIT
68 BPTR oldCDir = CurrentDir(GPB(nvdBase)->nvd_location);
69 BPTR lock = Lock(appName, SHARED_LOCK);
70 BOOL retval;
72 D(bug("Entering DeleteData()"));
74 if(lock == BNULL)
76 D(bug("Could not lock directory %s", appName));
77 CurrentDir(oldCDir);
78 return FALSE;
81 D(bug("Deleting file %s", itemName));
83 CurrentDir(lock);
85 retval = DeleteFile(itemName) == DOSTRUE ? TRUE : FALSE;
87 UnLock(lock);
88 CurrentDir(oldCDir);
90 return retval;
92 AROS_LIBFUNC_EXIT
93 } /* DeleteData */