~ubuntu-branches/ubuntu/trusty/python3.4/trusty-proposed

« back to all changes in this revision

Viewing changes to Mac/BuildScript/seticon.m

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2013-11-25 09:44:27 UTC
  • Revision ID: package-import@ubuntu.com-20131125094427-lzxj8ap5w01lmo7f
Tags: upstream-3.4~b1
ImportĀ upstreamĀ versionĀ 3.4~b1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Simple tool for setting an icon on a file.
 
3
 */
 
4
#import <Cocoa/Cocoa.h>
 
5
#include <stdio.h>
 
6
 
 
7
int main(int argc, char** argv)
 
8
{
 
9
        if (argc != 3) {
 
10
                fprintf(stderr, "Usage: seticon ICON TARGET");
 
11
                return 1;
 
12
        }
 
13
 
 
14
        NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
 
15
        NSString* iconPath = [NSString stringWithUTF8String:argv[1]];
 
16
        NSString* filePath = [NSString stringWithUTF8String:argv[2]];
 
17
 
 
18
        [NSApplication sharedApplication];
 
19
 
 
20
        [[NSWorkspace sharedWorkspace]
 
21
                setIcon: [[NSImage alloc] initWithContentsOfFile: iconPath]
 
22
                forFile: filePath
 
23
                options: 0];
 
24
        [pool release];
 
25
        return 0;
 
26
}