home *** CD-ROM | disk | FTP | other *** search
- /* ---------------------------------------------------------------------------------------------
- Find_icon, code for constructing icon suites for files and folders
-
- by James W. Walker
- preferred e-mail: <mailto:jwwalker@kagi.com>
- alternate e-mail: <mailto:jwwalker@aol.com>, <jim@nisus-soft.com>
- web: <http://users.aol.com/jwwalker/>
-
- File: Get_custom_folder_icon.c
-
- Copyright ©1997 by James W. Walker
-
- You may incorporate this sample code into your applications without
- restriction, though the sample code has been provided "AS IS" and the
- responsibility for its operation is 100% yours.
- If you're going to re-distribute the source, please make it clear
- that the code was descended from James W. Walker's code,
- but that you've made changes.
- ---------------------------------------------------------------------------------------------
- */
-
- #include <Icons.h>
- #include "Get_custom_folder_icon.h"
- #include "Get_custom_file_icon.h"
- #include "Get_icon_file_name.h"
-
- static Str31 sIconFileName = "\p";
-
- /* ------------------------------------------------------------------
- Get_custom_folder_icon Given a directory that is known to have
- a custom icon, create an icon suite
- for it.
-
- The icons are stored in an invisible file whose name, on a U.S.
- system, is "\pIcon\r". Unfortunately the name can vary in other
- countries, and is stored in the Finder.
- ------------------------------------------------------------------
- */
- OSErr Get_custom_folder_icon(
- /* --> */ short vRefNum,
- /* --> */ long dirID,
- /* --> */ MetaSelectorValue icon_selector,
- /* <-- */ Handle *the_suite
- )
- {
- FSSpec icon_file;
- OSErr err;
-
- if (sIconFileName[0] == 0)
- {
- Get_icon_file_name( sIconFileName );
- }
-
- err = FSMakeFSSpec( vRefNum, dirID, sIconFileName, &icon_file );
-
- if (err == noErr)
- {
- err = Get_custom_file_icon( &icon_file, icon_selector, the_suite );
- }
- return err;
- }
-