Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: 463c3f3eefbb706f4da1f17eb25a83968b636094 authored by Larry Hastings on 12 June 2016, 05:24:03 UTC
Release bump for 3.4.5rc1.
Tip revision: 463c3f3
seticon.m
/*
 * 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;
}
back to top