mirror of
https://github.com/python/cpython.git
synced 2024-11-25 10:54:51 +08:00
207b4c227f
svn+ssh://pythondev@svn.python.org/python/trunk ........ r70727 | ronald.oussoren | 2009-03-30 12:15:29 -0500 (Mon, 30 Mar 2009) | 5 lines * Updates installed dependencies to latest releaases (bzip, zlib, ...) * Changes code for updating folder icons from Python code that uses the deprecated Carbon module to a much simpler Cocoa program in Objective-C ........
27 lines
598 B
Objective-C
27 lines
598 B
Objective-C
/*
|
|
* Simple tool for setting an icon on a file.
|
|
*/
|
|
#import <Cocoa/Cocoa.h>
|
|
#include <stdio.h>
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
if (argc != 3) {
|
|
fprintf(stderr, "Usage: seticon ICON TARGET");
|
|
return 1;
|
|
}
|
|
|
|
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
|
|
NSString* iconPath = [NSString stringWithUTF8String:argv[1]];
|
|
NSString* filePath = [NSString stringWithUTF8String:argv[2]];
|
|
|
|
[NSApplication sharedApplication];
|
|
|
|
[[NSWorkspace sharedWorkspace]
|
|
setIcon: [[NSImage alloc] initWithContentsOfFile: iconPath]
|
|
forFile: filePath
|
|
options: 0];
|
|
[pool release];
|
|
return 0;
|
|
}
|