Initial import of Scalos. To decrease size I have
[AROS-Contrib.git] / scalos / Plugins / OOP / TitleClock / prefs / saveicon.c
blobfec4197e1af3eff6b4627416d661b0456e94e80d
1 /*
2 * saveicon.h Public protos for functions to deal with saving icons
4 * $Date$
5 * $Revision$
7 * 0.1
8 * 20010804 DM + Created. Added one function to save an icon (currently only
9 * saves a default projet icon) for a file, if the file exists.
13 #include <exec/types.h>
15 #include <proto/exec.h>
16 #include <proto/dos.h>
17 #include <proto/icon.h>
19 #include <workbench/workbench.h>
22 BOOL SaveIcon(STRPTR filename)
24 BOOL saved = FALSE;
25 BPTR flock;
26 struct DiskObject *ico; /* Icon to save */
28 if(filename)
30 /* Make sure file exists */
31 flock = Lock(filename, ACCESS_READ);
32 UnLock(flock);
34 if(flock)
36 if(NULL != (IconBase = OpenLibrary("icon.library", 36)) )
38 ico = GetDefDiskObject(WBPROJECT);
39 if(ico)
41 saved = PutDiskObject(filename, ico);
42 FreeDiskObject(ico);
44 CloseLibrary(IconBase);
48 return(saved);