PageRenderTime 12ms CodeModel.GetById 1ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/filesystems/grabfs/Cocoa/main.m

http://macfuse.googlecode.com/
Objective C | 31 lines | 19 code | 8 blank | 4 comment | 2 complexity | ec958ce60123b0ceafec4d9e16861713 MD5 | raw file
 1/*
 2 * Copyright Amit Singh. All Rights Reserved.
 3 * http://osxbook.com
 4 */
 5
 6#import <Cocoa/Cocoa.h>
 7
 8int
 9main(int argc, char *argv[])
10{
11    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
12
13    NSString *bin = [[NSBundle mainBundle] pathForResource:@"grabfs"
14                                                    ofType:NULL];
15    NSString *icns = [[NSBundle mainBundle] pathForResource:@"GrabFSVolume"
16                                                     ofType:@"icns"];
17
18    const char *bin_utf8 = [bin UTF8String];
19    const char *icns_utf8 = [icns UTF8String];
20    
21    char volicon_arg[4096];
22    snprintf(volicon_arg, 4096, "-ovolicon=%s", icns_utf8);
23
24    if (fork() == 0) {
25        execl(bin_utf8, bin_utf8, volicon_arg, NULL);
26    }
27
28    [pool release];
29
30    exit(0);
31}