[Python-checkins] r70950 - python/branches/release26-maint/Mac/BuildScript/seticon.m

ronald.oussoren python-checkins at python.org
Wed Apr 1 15:46:47 CEST 2009


Author: ronald.oussoren
Date: Wed Apr  1 15:46:47 2009
New Revision: 70950

Log:
Merge seticon.m file, for some reason 'svnmerge'
didn't actually add this file to the repository
(probably due me not being awake enough at the
time of the initial merge)


Added:
   python/branches/release26-maint/Mac/BuildScript/seticon.m

Added: python/branches/release26-maint/Mac/BuildScript/seticon.m
==============================================================================
--- (empty file)
+++ python/branches/release26-maint/Mac/BuildScript/seticon.m	Wed Apr  1 15:46:47 2009
@@ -0,0 +1,26 @@
+/*
+ * 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;
+}


More information about the Python-checkins mailing list