]> granicus.if.org Git - python/commitdiff
Merge seticon.m file, for some reason 'svnmerge'
authorRonald Oussoren <ronaldoussoren@mac.com>
Wed, 1 Apr 2009 13:46:47 +0000 (13:46 +0000)
committerRonald Oussoren <ronaldoussoren@mac.com>
Wed, 1 Apr 2009 13:46:47 +0000 (13:46 +0000)
didn't actually add this file to the repository
(probably due me not being awake enough at the
time of the initial merge)

Mac/BuildScript/seticon.m [new file with mode: 0644]

diff --git a/Mac/BuildScript/seticon.m b/Mac/BuildScript/seticon.m
new file mode 100644 (file)
index 0000000..04e3d7d
--- /dev/null
@@ -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;
+}