[futurebasic] Re: [FB] [XFB] .icns file with OSX folder icons

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : April 2004 : Group Archive : Group : All Groups

From: Robert Purves <robert.purves@...>
Date: Sat, 3 Apr 2004 16:32:39 +1200
H. Gluender wrote:

> does somebody know where in the many (hidden) places of OS X the .icns 
> file with >>> OS X folder icons <<< can be found?

No, but SaveSystemIconAsIcnsFile in the demo below should help you 
towards your (unstated) goal.

Robert P.


'----------
'~'A
'                       Runtime : Rntm Appearance.Incl
'                           CPU : Carbon
'~'B

include "Tlbx icons.incl"

toolbox fn WriteIconFile( IconFamilyHandle iconFamily, const FSSpec 
*iconFile) = OSErr

end globals

override _kOnSystemDisk = -32768 // fix obsolete definition of 
_kOnSystemDisk

local mode
local fn SaveSystemIconAsIcnsFile( type as OSType, fs as ^FSSpec )
'~'1
dim as IconRef          @ icon
dim as IconFamilyHandle @ iconFamily
dim as OSErr              err, ignore

err = fn GetIconRef( _kOnSystemDisk, _kSystemIconsCreator, type, @icon )
long if ( err == _noErr )
err = fn IconRefToIconFamily( icon, _kSelectorAllAvailableData, 
@iconFamily )
long if ( err == _noErr )
err = fn WriteIconFile( iconFamily, #fs )
DisposeHandle( iconFamily )
end if
ignore = fn ReleaseIconRef( icon )  // release what we got
end if
end fn = err


// main program
'~'1
dim as FSSpec  fs
dim as OSErr   err

long if ( files$( _FSSpecSave, "Save .icns file", "", fs ) != "" )
fs.name += ".icns"
err = fn SaveSystemIconAsIcnsFile( _kGenericFolderIcon, @fs )
if ( err ) then stop "Error " + str$( err )
end if
'----------