diff options
author | Ronald Oussoren <ronaldoussoren@mac.com> | 2009-03-30 17:20:30 (GMT) |
---|---|---|
committer | Ronald Oussoren <ronaldoussoren@mac.com> | 2009-03-30 17:20:30 (GMT) |
commit | 207b4c227f8d578f9366655232951944eac8725a (patch) | |
tree | e31983bc6b89fa7fc154b95678067b7fbfec4a97 /Mac/BuildScript/seticon.m | |
parent | 7af4ef8f0aa08bea37cf47186860cd10c2b9454f (diff) | |
download | cpython-207b4c227f8d578f9366655232951944eac8725a.zip cpython-207b4c227f8d578f9366655232951944eac8725a.tar.gz cpython-207b4c227f8d578f9366655232951944eac8725a.tar.bz2 |
Merged revisions 70727 via svnmerge from
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
........
Diffstat (limited to 'Mac/BuildScript/seticon.m')
-rw-r--r-- | Mac/BuildScript/seticon.m | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Mac/BuildScript/seticon.m b/Mac/BuildScript/seticon.m new file mode 100644 index 0000000..04e3d7d --- /dev/null +++ b/Mac/BuildScript/seticon.m @@ -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; +} |