Sets the icon for the file or directory at the specified path.
- macOS 10.4+
The image to use as the icon for the file or directory.
The full path of the file or directory.
The icon representations to generate from the image. You specify this value by combining the appropriate
NSWorkspaceconstants, using the C bitwise
Icon Creation Options
0if you want to generate icons in all available icon representation formats.
YES if the icon was set; otherwise,
image can be an arbitrary image, with or without transparency. The method automatically scales this image (as needed) to generate the icon representations. The file or folder must exist and be writable by the user.
This method uses the image to set an icon with a size of 512 pixels by 512 pixels. If you specify the
NSExclude10 option (not recommended), this method creates an icon that is compatible with the Finder from macOS 10.2 or earlier.
You can safely call this method from any of your app’s threads, but you must call it from only one thread at a time.