Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 68 lines (56 sloc) 1.511 kB
ffdc5a1 @tomcool420 adding SMFComplexProcess...
authored
1 //
2 // SMFComplexProcessDropShadowControl.m
3 // SMFramework
4 //
5 // Created by Thomas Cool on 2/28/11.
6 // Copyright 2011 Thomas Cool. All rights reserved.
7 //
8
9 #import "SMFComplexProcessDropShadowControl.h"
10
cb32939 @tomcool420 delegate method
authored
11 @interface NSObject (smfcpdsc)
12 -(void)process:(SMFComplexProcessDropShadowControl *)p ended:(NSString *)s;
a086f07 @tomcool420 delegate method
authored
13
14 @end
ffdc5a1 @tomcool420 adding SMFComplexProcess...
authored
15
16 @implementation SMFComplexProcessDropShadowControl
17 @synthesize ap;
f50d1fc @tomcool420 adding support for return codes
authored
18 @synthesize returnCode;
19 @synthesize finished;
20 -(id)init
21 {
22 self=[super init];
23 returnCode=YES;
24 finished=NO;
25 return self;
26 }
ffdc5a1 @tomcool420 adding SMFComplexProcess...
authored
27 -(void)controlWasActivated
28 {
13ceea2 fixed autorelease leak in SMFComplexProcessDropShadowControl and buil…
FireCore, LLC authored
29
ffdc5a1 @tomcool420 adding SMFComplexProcess...
authored
30 [super controlWasActivated];
31 [self performSelectorInBackground:@selector(runProcess) withObject:nil];
32 }
c66a493 @tomcool420 fixing some mem leaks, adding KVO to SMFComplexDropShadowControl
authored
33 -(void)dealloc
34 {
35 self.ap=nil;
36 [super dealloc];
37 }
f50d1fc @tomcool420 adding support for return codes
authored
38 -(int)runProcess
ffdc5a1 @tomcool420 adding SMFComplexProcess...
authored
39 {
13ceea2 fixed autorelease leak in SMFComplexProcessDropShadowControl and buil…
FireCore, LLC authored
40 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
ffdc5a1 @tomcool420 adding SMFComplexProcess...
authored
41 char line[200];
42
43 FILE* fp = popen([ap UTF8String], "r");
f50d1fc @tomcool420 adding support for return codes
authored
44 // NSMutableArray *lines = [[NSMutableArray alloc]init];
ffdc5a1 @tomcool420 adding SMFComplexProcess...
authored
45 if (fp)
46 {
47 while (fgets(line, sizeof line, fp))
48 {
49 NSString *s = [NSString stringWithCString:line encoding:NSUTF8StringEncoding];
88ab269 @tomcool420 updating
authored
50 // NSLog(@"s: %@",s);
ffdc5a1 @tomcool420 adding SMFComplexProcess...
authored
51 [self performSelectorOnMainThread:@selector(appendToText:) withObject:[s stringByAppendingString:@"\n"] waitUntilDone:YES];
52 }
53 }
8033259 @tomcool420 new changes
authored
54
f50d1fc @tomcool420 adding support for return codes
authored
55 returnCode = pclose(fp);
56 finished =YES;
8033259 @tomcool420 new changes
authored
57
58
cb32939 @tomcool420 delegate method
authored
59 if ([self.delegate respondsToSelector:@selector(process:ended:)]) {
60 [self.delegate process:self ended:ap];
a086f07 @tomcool420 delegate method
authored
61 }
4b35fd5 SMFComplexDropShadowControl reports failure or success in the subtitle
FireCore, LLC authored
62
63
13ceea2 fixed autorelease leak in SMFComplexProcessDropShadowControl and buil…
FireCore, LLC authored
64 [pool release];
f50d1fc @tomcool420 adding support for return codes
authored
65 return returnCode;
ffdc5a1 @tomcool420 adding SMFComplexProcess...
authored
66 }
67 @end
Something went wrong with that request. Please try again.