325{
326 NSDirectoryEnumerator *dirEnum =
nil;
327 NSString *name =
nil,
333 NSMutableDictionary *directoryListings =
nil,
334 *directoryCases =
nil,
336 NSDictionary *dirFiles =
nil;
337 NSSet *readMeNames =
nil;
338
339 _basePath = [[[self verifier] oxpPath] copy];
340
341 _junkFileNames = [[self verifier] configurationSetForKey:@"junkFiles"];
342 _skipDirectoryNames = [[self verifier] configurationSetForKey:@"skipDirectories"];
343
344 directoryCases = [NSMutableDictionary dictionary];
345 directoryListings = [NSMutableDictionary dictionary];
346 rootFiles = [NSMutableDictionary dictionary];
347 readMeNames = [self constructReadMeNames];
348
349 dirEnum = [[NSFileManager defaultManager] enumeratorAtPath:_basePath];
350 while ((name = [dirEnum nextObject]))
351 {
352 path = [_basePath stringByAppendingPathComponent:name];
353 type = [[dirEnum fileAttributes] fileType];
354 lcName = [name lowercaseString];
355
356 if ([type isEqualToString:NSFileTypeDirectory])
357 {
358 [dirEnum skipDescendents];
359
360 if ([_skipDirectoryNames containsObject:name])
361 {
362
363 OOLog(
@"verifyOXP.verbose.listFiles",
@"- Skipping %@/", name);
364 }
365 else if (!
CheckNameConflict(lcName, directoryCases, rootFiles, &existing, &existingType))
366 {
367 OOLog(
@"verifyOXP.verbose.listFiles",
@"- %@/", name);
369 dirFiles = [self scanDirectory:path];
370 [directoryListings setObject:dirFiles forKey:lcName];
371 [directoryCases setObject:name forKey:lcName];
373 }
374 else
375 {
376 OOLog(
@"verifyOXP.scanFiles.overloadedName",
@"***** ERROR: %@ '%@' conflicts with %@ named '%@', ignoring. (OXPs must work on case-insensitive file systems!)",
@"directory", name, existingType, existing);
377 }
378 }
379 else if ([type isEqualToString:NSFileTypeRegular])
380 {
381 if ([_junkFileNames containsObject:name])
382 {
383 OOLog(
@"verifyOXP.scanFiles.skipJunk",
@"NOTE: skipping junk file %@.", name);
384 }
385 else if ([readMeNames containsObject:lcName])
386 {
387 OOLog(
@"verifyOXP.scanFiles.readMe",
@"----- WARNING: apparent Read Me file (\"%@\
") inside OXP. This is the wrong place for a Read Me file, because it will not be read.", name);
388 }
389 else if (!
CheckNameConflict(lcName, directoryCases, rootFiles, &existing, &existingType))
390 {
391 OOLog(
@"verifyOXP.verbose.listFiles",
@"- %@", name);
392 [rootFiles setObject:name forKey:lcName];
393 }
394 else
395 {
396 OOLog(
@"verifyOXP.scanFiles.overloadedName",
@"***** ERROR: %@ '%@' conflicts with %@ named '%@', ignoring. (OXPs must work on case-insensitive file systems!)",
@"file", name, existingType, existing);
397 }
398 }
399 else if ([type isEqualToString:NSFileTypeSymbolicLink])
400 {
401 OOLog(
@"verifyOXP.scanFiles.symLink",
@"----- WARNING: \"%@\
" is a symbolic link, ignoring.", name);
402 }
403 else
404 {
405 OOLog(
@"verifyOXP.scanFiles.nonStandardFile",
@"----- WARNING: \"%@\
" is a non-standard file (%@), ignoring.", name, type);
406 }
407 }
408
409 _junkFileNames =
nil;
410 _skipDirectoryNames =
nil;
411
412 [directoryListings setObject:rootFiles forKey:@""];
413 _directoryListings = [directoryListings copy];
414 _directoryCases = [directoryCases copy];
415}
static BOOL CheckNameConflict(NSString *lcName, NSDictionary *directoryCases, NSDictionary *rootFiles, NSString **outExisting, NSString **outExistingType)
#define OOLogOutdentIf(class)
#define OOLogIndentIf(class)