45+ (NSArray*)worldScriptsAtPath:(NSString*)path
47 NSFileManager* fmgr =
nil;
48 NSString* filePath =
nil;
50 NSArray* result =
nil;
52 BOOL foundScript = NO;
57 filePath = [
path stringByAppendingPathComponent:@"world-scripts.plist"];
58 if (filePath !=
nil) {
68 filePath = [
path stringByAppendingPathComponent:@"script.js"];
69 if ([fmgr oo_oxzFileExistsAtPath:filePath])
72 filePath = [
path stringByAppendingPathComponent:@"script.es"];
73 if ([fmgr oo_oxzFileExistsAtPath:filePath])
82 result = [
NSArray arrayWithObject:script];
93 filePath = [
path stringByAppendingPathComponent:@"script.plist"];
94 if ([fmgr oo_oxzFileExistsAtPath:filePath]) {
112 if (result ==
nil && foundScript) {
119+ (NSArray*)scriptsFromFileNamed:(NSString*)fileName
121 NSArray* result =
nil;
128 OOLogERR(
@"script.load.notFound",
@"Could not find script file %@.", fileName);
134+ (NSArray*)scriptsFromList:(NSArray*)fileNames
137 NSMutableArray* result =
nil;
138 NSArray* scripts =
nil;
142 foreach (
name, fileNames) {
145 [
result addObjectsFromArray:scripts];
151+ (NSArray*)scriptsFromFileAtPath:(NSString*)filePath
154 if (![[NSFileManager defaultManager] oo_oxzFileExistsAtPath:filePath])
157 NSString* extension = [[
filePath pathExtension] lowercaseString];
159 if ([extension isEqualToString:
@"js"] || [extension isEqualToString:
@"es"]) {
160 NSArray* result =
nil;
163 result = [
NSArray arrayWithObject:script];
165 }
else if ([extension isEqualToString:
@"plist"]) {
173 OOLogERR(
@"script.load.badName",
@"Don't know how to load a script from %@.", filePath);
177+ (id)jsScriptFromFileNamed:(NSString*)fileName properties:(NSDictionary*)properties
179 NSString* extension =
nil;
180 NSString* path =
nil;
182 if ([fileName length] == 0)
185 extension = [[
fileName pathExtension] lowercaseString];
186 if ([extension isEqualToString:
@"js"] || [extension isEqualToString:
@"es"]) {
189 OOLogERR(
@"script.load.notFound",
@"Could not find script file %@.", fileName);
193 }
else if ([extension isEqualToString:
@"plist"]) {
194 OOLogERR(
@"script.load.badName",
@"Can't load script named %@ - legacy scripts are not supported in this context.", fileName);
198 OOLogERR(
@"script.load.badName",
@"Don't know how to load a script from %@.", fileName);
202+ (id)jsAIScriptFromFileNamed:(NSString*)fileName properties:(NSDictionary*)properties
204 NSString* extension =
nil;
205 NSString* path =
nil;
207 if ([fileName length] == 0)
210 extension = [[
fileName pathExtension] lowercaseString];
211 if ([extension isEqualToString:
@"js"] || [extension isEqualToString:
@"es"]) {
214 OOLogERR(
@"script.load.notFound",
@"Could not find script file %@.", fileName);
218 }
else if ([extension isEqualToString:
@"plist"]) {
219 OOLogERR(
@"script.load.badName",
@"Can't load script named %@ - legacy scripts are not supported in this context.", fileName);
223 OOLogERR(
@"script.load.badName",
@"Don't know how to load a script from %@.", fileName);
256 return [
NSString stringWithFormat:@"%@ %@", name, version];
258 return [
NSString stringWithFormat:@"%@", name];
void OOStandardsDeprecated(NSString *message)
BOOL OOEnforceStandards(void)
#define OOLogERR(class, format,...)
#define OOLogOutdentIf(class)
#define OOLog(class, format,...)
#define OOLogIndentIf(class)
NSString *const kOOLogSubclassResponsibility
NSArray * OOArrayFromFile(NSString *path)
static NSString *const kOOLogLoadScriptPList
static NSString *const kOOLogLoadScriptNone
static NSString *const kOOLogLoadScriptOK
static NSString *const kOOLogLoadScriptParseError
static NSString *const kOOLogLoadScriptJavaScript
id scriptWithPath:properties:(NSString *path,[properties] NSDictionary *properties)
NSArray * scriptsInPListFile:(NSString *filePath)
NSArray * scriptsFromList:(NSArray *fileNames)
NSString * scriptDescription()
NSString * descriptionComponents()
NSArray * scriptsFromFileNamed:(NSString *fileName)
NSArray * scriptsFromFileAtPath:(NSString *filePath)
NSString * pathForFileNamed:inFolder:(NSString *fileName,[inFolder] NSString *folderName)