-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathKinemeFileInfo.m
60 lines (50 loc) · 1.58 KB
/
KinemeFileInfo.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#import "KinemeFileInfo.h"
@implementation KinemeFileInfo : QCPatch
+ (QCPatchExecutionMode)executionModeWithIdentifier:(id)fp8
{
return kQCPatchExecutionModeProcessor;
}
+ (BOOL)allowsSubpatchesWithIdentifier:(id)fp8
{
return NO;
}
+ (QCPatchTimeMode)timeModeWithIdentifier:(id)fp8
{
return kQCPatchTimeModeNone;
}
- (id)initWithIdentifier:(id)fp8
{
if(self=[super initWithIdentifier:fp8])
{
[[self userInfo] setObject:@"Kineme File Info" forKey:@"name"];
}
return self;
}
- (BOOL)execute:(QCOpenGLContext *)context time:(double)time arguments:(NSDictionary *)arguments
{
if( [inputPath wasUpdated] )
{
NSString *path = KIExpandPath(self,[inputPath stringValue]);
NSFileManager *defaultManager = [NSFileManager defaultManager];
if( [defaultManager fileExistsAtPath: path] )
{
[outputExists setBooleanValue: YES];
NSDictionary *dict = [defaultManager fileAttributesAtPath: path traverseLink:TRUE];
[outputSize setIndexValue: [[dict objectForKey:NSFileSize] integerValue]];
[outputCreatedTime setDoubleValue: [[dict objectForKey:NSFileCreationDate] timeIntervalSince1970]];
[outputModifiedTime setDoubleValue: [[dict objectForKey:NSFileModificationDate] timeIntervalSince1970]];
[outputType setStringValue: [dict objectForKey:NSFileType]];
}
else // doesn't exist, clear everything
{
[outputExists setBooleanValue: FALSE];
[outputType setStringValue: @""];
[outputSize setIndexValue: 0];
[outputCreatedTime setDoubleValue: 0.0];
[outputModifiedTime setDoubleValue: 0.0];
//[outputAccessedTime setDoubleValue: 0.0];
}
}
return YES;
}
@end