-
- Class fsinterpreterClass;
- if (fsinterpreterClass = NSClassFromString(@"FSInterpreter")) {
- NSArray *fscriptPaths = [NSBundle pathsForResourcesOfType:@"fscriptplugin" inDirectory:[[NSBundle mainBundle] builtInPlugInsPath]];
- NSEnumerator *fscriptPathEnumerator = [fscriptPaths objectEnumerator];
- id fscriptPath;
-
- while (fscriptPath = [fscriptPathEnumerator nextObject]) {
- NSString *fscriptSource = [NSString stringWithContentsOfFile:fscriptPath];
- if (fscriptSource) {
- id fscriptInterpreter = [(id <_ITKitITApplicationControllerFSInterpreterCompatibility>)[fsinterpreterClass alloc] init];
- id result;
- [fscriptInterpreter setObject:self forIdentifier:@"applicationController"];
- [fscriptInterpreter setObject:fscriptInterpreter forIdentifier:@"hostInterpreter"];
- result = [fscriptInterpreter execute:fscriptSource];
- if (![result isOK]) {
- NSRunAlertPanel(@"F-Script Plugin Error",[NSString stringWithFormat:@"Plugin: %@\nRange: %@\nMessage:%@", fscriptPath, NSStringFromRange([result errorRange]), [result errorMessage]],@"Dismiss",nil,nil);
- [fscriptInterpreter release];
- } else {
- [_plugins addObject:[fscriptInterpreter autorelease]];
- }
- }
- }
- }