- Timestamp:
- 11/16/07 16:50:01 (14 months ago)
- Location:
- trunk
- Files:
-
- 4 modified
-
MFFilesystem.h (modified) (1 diff)
-
MFFilesystem.m (modified) (7 diffs)
-
MFPlugin.h (modified) (1 diff)
-
MFPlugin.m (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/MFFilesystem.h
r3 r4 8 8 9 9 #import <Cocoa/Cocoa.h> 10 10 @class MFPlugin; 11 11 12 12 @interface MFFilesystem : NSObject { -
trunk/MFFilesystem.m
r3 r4 8 8 9 9 #import "MFFilesystem.h" 10 10 #import "MFPluginController.h" 11 #import "MFPlugin.h" 11 12 12 13 @interface MFFilesystem(PrivateAPI) 13 - ( void)mergeParameters;14 - (NSArray*)taskArgumentList 14 - (NSMutableDictionary*)fullParametersWithDictionary: (NSDictionary*)fsParams; 15 - (NSArray*)taskArgumentList; 15 16 @end 16 17 … … 30 31 } 31 32 33 32 34 - (MFPlugin*)plugin 33 35 { … … 39 41 { 40 42 // We want an immutable dictionary 41 return [parameter Dictionarycopy];43 return [parameters copy]; 42 44 } 43 45 44 - ( void)mergeParameters:(NSDictionary*)params46 - (NSMutableDictionary*)fullParametersWithDictionary:(NSDictionary*)fsParams 45 47 { 46 NSDictionary* defaults = [[self plugin] defaultParameterDict]; 47 for(NSString* parameterKey in [defaults keyEnumerator]) 48 MFPlugin* plugin = [self plugin]; 49 NSDictionary* defaultParams = [plugin defaultParameterDictionary]; 50 NSMutableDictionary* params = [NSMutableDictionary dictionary]; 51 52 for(NSString* parameterKey in [defaultParams keyEnumerator]) 48 53 { 49 if ([ params objectForKey:parameterKey] != nil)54 if ([fsParams objectForKey:parameterKey] != nil) 50 55 { 51 56 // The fs specifies a value for this parameter, take it. 52 57 // Validation per-value goes here 53 [param eters setObject: [params objectForKey:parameterKey]54 forKey: parameterKey];58 [params setObject: [fsParams objectForKey:parameterKey] 59 forKey: parameterKey]; 55 60 } 56 61 else … … 58 63 // The fs doesn't specify a value for this parameter. 59 64 // Use the default 60 [param eters setObject: [defaults objectForKey:parameterKey]61 forKey: parameterKey];65 [params setObject: [defaultParams objectForKey:parameterKey] 66 forKey: parameterKey]; 62 67 } 63 68 64 69 } 70 71 return params; 65 72 } 66 73 … … 80 87 // TODO: Value typing 81 88 NSString* searchString = [NSString stringWithFormat:@"[%@]", token]; 82 id *value = [parameters objectForKey:parameterKey];89 id value = [parameters objectForKey:parameterKey]; 83 90 NSString* stringValue; 84 91 if ([value isKindOfClass: [NSString class]]) … … 94 101 withString:value 95 102 options:NSLiteralSearch 96 range:NSMakeRange(0, [ receiverlength])];103 range:NSMakeRange(0, [formatString length])]; 97 104 } 98 105 … … 103 110 104 111 argParameters = [formatString componentsSeparatedByString:@" "]; 112 return argParameters; 105 113 } 106 114 107 115 - (NSTask*)taskForLaunch 108 116 { 109 117 return nil; 110 118 } 111 119 -
trunk/MFPlugin.h
r3 r4 19 19 @property(readonly) NSString* inputFormatString; 20 20 21 +(MFPlugin*)pluginFromBundleAtPath:(NSString*)path; 21 + (MFPlugin*)pluginFromBundleAtPath:(NSString*)path; 22 23 - (NSDictionary*)defaultParameterDictionary; 22 24 23 25 @end -
trunk/MFPlugin.m
r3 r4 34 34 } 35 35 36 - ( void)defaultParameterDict36 - (NSDictionary*)defaultParameterDictionary 37 37 { 38 38 NSMutableDictionary* defaultsDictionary = [NSMutableDictionary dictionary]; … … 45 45 forKey:parameterKey]; 46 46 } 47 48 return defaultsDictionary; 47 49 } 48 50 … … 54 56 - (NSString*)taskPath 55 57 { 56 NSArray* locationsArray = [dictionary objectForKey:@"Binary Location"] 58 NSArray* locationsArray = [dictionary objectForKey:@"Binary Location"]; 57 59 NSFileManager* fm = [NSFileManager defaultManager]; 58 60 for(NSString* path in locationsArray) … … 74 76 } 75 77 } 78 79 // We can't find the executablr 80 return nil; 76 81 } 77 82
