Oolite 1.91.0.7645-241119-222d325
Loading...
Searching...
No Matches
OOFileScannerVerifierStage Class Reference

#include <OOFileScannerVerifierStage.h>

+ Inheritance diagram for OOFileScannerVerifierStage:
+ Collaboration diagram for OOFileScannerVerifierStage:

Instance Methods

(BOOL) - fileExists:inFolder:referencedFrom:checkBuiltIn:
 
(NSString *) - pathForFile:inFolder:referencedFrom:checkBuiltIn:
 
(NSData *) - dataForFile:inFolder:referencedFrom:checkBuiltIn:
 
(id) - plistNamed:inFolder:referencedFrom:checkBuiltIn:
 
(id) - displayNameForFile:andFolder:
 
(NSArray *) - filesInFolder:
 
(void) - dealloc [implementation]
 
(NSString *) - name [implementation]
 
(void) - run [implementation]
 
(void) - scanForFiles [implementation]
 
(void) - checkRootFolders [implementation]
 
(void) - checkKnownFiles [implementation]
 
(NSDictionary *) - lowercaseMap: [implementation]
 
(NSDictionary *) - scanDirectory: [implementation]
 
(void) - checkPListFormat:file:folder: [implementation]
 
(NSSet *) - constructReadMeNames [implementation]
 
(void) - checkConfigFiles [implementation]
 
- Instance Methods inherited from OOOXPVerifierStage
(OOOXPVerifier *) - verifier
 
(BOOL) - completed
 
(NSSet *) - dependencies
 
(NSSet *) - dependents
 
(BOOL) - shouldRun
 
(id) - init [implementation]
 
(id) - description [implementation]
 
(void) - setVerifier: [implementation]
 
(BOOL) - isDependentOf: [implementation]
 
(void) - registerDependency: [implementation]
 
(void) - dependencyRegistrationComplete [implementation]
 
(BOOL) - canRun [implementation]
 
(void) - performRun [implementation]
 
(void) - noteSkipped [implementation]
 
(NSSet *) - resolvedDependencies [implementation]
 
(NSSet *) - resolvedDependents [implementation]
 
(void) - registerDepedent: [implementation]
 
(void) - dependencyCompleted: [implementation]
 

Class Methods

(NSString *) + nameForDependencyForVerifier:
 

Private Attributes

NSString * _basePath
 
NSMutableSet * _usedFiles
 
NSMutableSet * _caseWarnings
 
NSDictionary * _directoryListings
 
NSDictionary * _directoryCases
 
NSMutableSet * _badPLists
 
NSSet * _junkFileNames
 
NSSet * _skipDirectoryNames
 

Detailed Description

Definition at line 36 of file OOFileScannerVerifierStage.h.

Method Documentation

◆ checkConfigFiles

- (void) checkConfigFiles
implementation

Provided by category OOFileScannerVerifierStage(OOPrivate).

Definition at line 761 of file OOFileScannerVerifierStage.m.

445{
446 NSArray *knownNames = nil;
447 NSEnumerator *nameEnum = nil;
448 NSString *name = nil,
449 *lcName = nil,
450 *realFileName = nil;
451 BOOL inConfigDir;
452
453 knownNames = [[self verifier] configurationArrayForKey:@"knownConfigFiles"];
454 for (nameEnum = [knownNames objectEnumerator]; (name = [nameEnum nextObject]); )
455 {
456 if (![name isKindOfClass:[NSString class]]) continue;
457
458 /* In theory, we could use -fileExists:inFolder:referencedFrom:checkBuiltIn:
459 here, but we want a different error message.
460 */
461
462 lcName = [name lowercaseString];
463 realFileName = [[_directoryListings oo_dictionaryForKey:@"config"] objectForKey:lcName];
464 inConfigDir = realFileName != nil;
465 if (!inConfigDir) realFileName = [[_directoryListings oo_dictionaryForKey:@""] objectForKey:lcName];
466 if (realFileName == nil) continue;
467
468 if (![realFileName isEqualToString:name])
469 {
470 if (inConfigDir) realFileName = [@"Config" stringByAppendingPathComponent:realFileName];
471 OOLog(@"verifyOXP.files.caseMismatch", @"***** ERROR: case mismatch: configuration file '%@' should be called '%@'.", realFileName, name);
472 }
473 }
474}
#define OOLog(class, format,...)
Definition OOLogging.h:88
return nil

◆ checkKnownFiles

- (void) checkKnownFiles
implementation

Provided by category OOFileScannerVerifierStage(OOPrivate).

Definition at line 761 of file OOFileScannerVerifierStage.m.

478{
479 NSDictionary *directories = nil;
480 NSEnumerator *directoryEnum = nil;
481 NSString *directory = nil,
482 *lcDirectory = nil;
483 NSArray *fileList = nil;
484 NSEnumerator *nameEnum = nil;
485 NSString *name = nil,
486 *lcName = nil,
487 *realFileName = nil;
488 BOOL inDirectory;
489
490 directories = [[self verifier] configurationDictionaryForKey:@"knownFiles"];
491 for (directoryEnum = [directories keyEnumerator]; (directory = [directoryEnum nextObject]); )
492 {
493 fileList = [directories objectForKey:directory];
494 lcDirectory = [directory lowercaseString];
495 for (nameEnum = [fileList objectEnumerator]; (name = [nameEnum nextObject]); )
496 {
497 if (![name isKindOfClass:[NSString class]]) continue;
498
499 /* In theory, we could use -fileExists:inFolder:referencedFrom:checkBuiltIn:
500 here, but we want a different error message.
501 */
502
503 lcName = [name lowercaseString];
504 realFileName = [[_directoryListings oo_dictionaryForKey:lcDirectory] objectForKey:lcName];
505 inDirectory = (realFileName != nil);
506 if (!inDirectory)
507 {
508 // Allow for files in root directory of OXP
509 realFileName = [[_directoryListings oo_dictionaryForKey:@""] objectForKey:lcName];
510 }
511 if (realFileName == nil) continue;
512
513 if (![realFileName isEqualToString:name])
514 {
515 if (inDirectory) realFileName = [directory stringByAppendingPathComponent:realFileName];
516 OOLog(@"verifyOXP.files.caseMismatch", @"***** ERROR: case mismatch: file '%@' should be called '%@'.", realFileName, name);
517 }
518 }
519 }
520}

◆ checkPListFormat:file:folder:

- (void) checkPListFormat: (NSPropertyListFormat) format
file: (NSString *) file
folder: (NSString *) folder 
implementation

Provided by category OOFileScannerVerifierStage(OOPrivate).

Definition at line 761 of file OOFileScannerVerifierStage.m.

616 :(NSPropertyListFormat)format file:(NSString *)file folder:(NSString *)folder
617{
618 NSString *weirdnessKey = nil;
619 NSString *formatDesc = nil;
620 NSString *displayPath = nil;
621
622 if (format != NSPropertyListOpenStepFormat && format != NSPropertyListXMLFormat_v1_0)
623 {
624 displayPath = [self displayNameForFile:file andFolder:folder];
625 weirdnessKey = [displayPath lowercaseString];
626
627 if (![_badPLists containsObject:weirdnessKey])
628 {
629 // Warn about "non-standard" format
630 [_badPLists addObject:weirdnessKey];
631
632 switch (format)
633 {
634 case NSPropertyListBinaryFormat_v1_0:
635 formatDesc = @"Apple binary format";
636 break;
637
638#if OOLITE_GNUSTEP
639 case NSPropertyListGNUstepFormat:
640 formatDesc = @"GNUstep text format";
641 break;
642
643 case NSPropertyListGNUstepBinaryFormat:
644 formatDesc = @"GNUstep binary format";
645 break;
646#endif
647
648 default:
649 formatDesc = [NSString stringWithFormat:@"unknown format (%i)", (int)format];
650 }
651
652 OOLog(@"verifyOXP.plist.weirdFormat", @"----- WARNING: Property list %@ is in %@; OpenStep text format and XML format are the recommended formats for Oolite.", displayPath, formatDesc);
653 }
654 }
655}

◆ checkRootFolders

- (void) checkRootFolders
implementation

Provided by category OOFileScannerVerifierStage(OOPrivate).

Definition at line 761 of file OOFileScannerVerifierStage.m.

419{
420 NSArray *knownNames = nil;
421 NSEnumerator *nameEnum = nil;
422 NSString *name = nil;
423 NSString *lcName = nil;
424 NSString *actual = nil;
425
426 knownNames = [[self verifier] configurationArrayForKey:@"knownRootDirectories"];
427 for (nameEnum = [knownNames objectEnumerator]; (name = [nameEnum nextObject]); )
428 {
429 if (![name isKindOfClass:[NSString class]]) continue;
430
431 lcName = [name lowercaseString];
432 actual = [_directoryCases objectForKey:lcName];
433 if (actual == nil) continue;
434
435 if (![actual isEqualToString:name])
436 {
437 OOLog(@"verifyOXP.files.caseMismatch", @"***** ERROR: case mismatch: directory '%@' should be called '%@'.", actual, name);
438 }
439 [_caseWarnings addObject:lcName];
440 }
441}

◆ constructReadMeNames

- (NSSet *) constructReadMeNames
implementation

Provided by category OOFileScannerVerifierStage(OOPrivate).

Definition at line 761 of file OOFileScannerVerifierStage.m.

659{
660 NSDictionary *dict = nil;
661 NSArray *stems = nil,
662 *extensions = nil;
663 NSMutableSet *result = nil;
664 NSUInteger i, j, stemCount, extCount;
665 NSString *stem = nil,
666 *extension = nil;
667
668 dict = [[self verifier] configurationDictionaryForKey:@"readMeNames"];
669 stems = [dict oo_arrayForKey:@"stems"];
670 extensions = [dict oo_arrayForKey:@"extensions"];
671 stemCount = [stems count];
672 extCount = [extensions count];
673 if (stemCount * extCount == 0) return nil;
674
675 // Construct all stem+extension permutations
676 result = [NSMutableSet setWithCapacity:stemCount * extCount];
677 for (i = 0; i != stemCount; ++i)
678 {
679 stem = [[stems oo_stringAtIndex:i] lowercaseString];
680 if (stem != nil)
681 {
682 for (j = 0; j != extCount; ++j)
683 {
684 extension = [[extensions oo_stringAtIndex:j] lowercaseString];
685 if (extension != nil)
686 {
687 [result addObject:[stem stringByAppendingString:extension]];
688 }
689 }
690 }
691 }
692
693 return result;
694}

◆ dataForFile:inFolder:referencedFrom:checkBuiltIn:

- (NSData *) dataForFile: (NSString *) file
inFolder: (NSString *) folder
referencedFrom: (NSString *) context
checkBuiltIn: (BOOL) checkBuiltIn 

Definition at line 761 of file OOFileScannerVerifierStage.m.

225 :(NSString *)file
226 inFolder:(NSString *)folder
227 referencedFrom:(NSString *)context
228 checkBuiltIn:(BOOL)checkBuiltIn
229{
230 NSString *path = nil;
231
232 path = [self pathForFile:file inFolder:folder referencedFrom:context checkBuiltIn:checkBuiltIn];
233 if (path == nil) return nil;
234
235 return [NSData dataWithContentsOfMappedFile:path];
236}

◆ dealloc

- (void) dealloc
implementation

Reimplemented from OOOXPVerifierStage.

Definition at line 761 of file OOFileScannerVerifierStage.m.

88{
89 [_basePath release];
90 [_usedFiles release];
91 [_caseWarnings release];
92 [_directoryListings release];
93 [_directoryCases release];
94 [_badPLists release];
95
96 [super dealloc];
97}

◆ displayNameForFile:andFolder:

- (id) displayNameForFile: (NSString *) file
andFolder: (NSString *) folder 

Definition at line 761 of file OOFileScannerVerifierStage.m.

306 :(NSString *)file andFolder:(NSString *)folder
307{
308 if (file != nil && folder != nil) return [folder stringByAppendingPathComponent:file];
309 return file;
310}

◆ fileExists:inFolder:referencedFrom:checkBuiltIn:

- (BOOL) fileExists: (NSString *) file
inFolder: (NSString *) folder
referencedFrom: (NSString *) context
checkBuiltIn: (BOOL) checkBuiltIn 

Definition at line 761 of file OOFileScannerVerifierStage.m.

139 :(NSString *)file
140 inFolder:(NSString *)folder
141 referencedFrom:(NSString *)context
142 checkBuiltIn:(BOOL)checkBuiltIn
143{
144 return [self pathForFile:file inFolder:folder referencedFrom:context checkBuiltIn:checkBuiltIn] != nil;
145}

◆ filesInFolder:

- (NSArray *) filesInFolder: (NSString *) folder

Definition at line 761 of file OOFileScannerVerifierStage.m.

313 :(NSString *)folder
314{
315 if (folder == nil) return nil;
316 return [[_directoryListings objectForKey:[folder lowercaseString]] allValues];
317}

◆ lowercaseMap:

- (NSDictionary *) lowercaseMap: (NSArray *) array
implementation

Provided by category OOFileScannerVerifierStage(OOPrivate).

Definition at line 761 of file OOFileScannerVerifierStage.m.

523 :(NSArray *)array
524{
525 NSUInteger i, count;
526 NSString *canonical = nil,
527 *lowercase = nil;
528 NSMutableDictionary *result = nil;
529
530 count = [array count];
531 if (count == 0) return [NSDictionary dictionary];
532 result = [NSMutableDictionary dictionaryWithCapacity:count];
533
534 for (i = 0; i != count; ++i)
535 {
536 canonical = [array oo_stringAtIndex:i];
537 if (canonical != nil)
538 {
539 lowercase = [canonical lowercaseString];
540 [result setObject:canonical forKey:lowercase];
541 }
542 }
543
544 return result;
545}
unsigned count

◆ name

- (NSString *) name
implementation

Reimplemented from OOOXPVerifierStage.

Definition at line 761 of file OOFileScannerVerifierStage.m.

101{
103}
static NSString *const kFileScannerStageName

◆ nameForDependencyForVerifier:

+ (NSString *) nameForDependencyForVerifier: (OOOXPVerifier *) verifier

Definition at line 761 of file OOFileScannerVerifierStage.m.

126{
127 OOFileScannerVerifierStage *stage = [verifier stageWithName:kFileScannerStageName];
128 if (stage == nil)
129 {
130 stage = [[OOFileScannerVerifierStage alloc] init];
131 [verifier registerStage:stage];
132 [stage release];
133 }
134
136}
OOOXPVerifier * verifier()
id stageWithName:(NSString *name)
void registerStage:(OOOXPVerifierStage *stage)

◆ pathForFile:inFolder:referencedFrom:checkBuiltIn:

- (NSString *) pathForFile: (NSString *) file
inFolder: (NSString *) folder
referencedFrom: (NSString *) context
checkBuiltIn: (BOOL) checkBuiltIn 

Definition at line 761 of file OOFileScannerVerifierStage.m.

148 :(NSString *)file
149 inFolder:(NSString *)folder
150 referencedFrom:(NSString *)context
151 checkBuiltIn:(BOOL)checkBuiltIn
152{
153 NSString *lcName = nil,
154 *lcDirName = nil,
155 *realDirName = nil,
156 *realFileName = nil,
157 *path = nil,
158 *expectedPath = nil;
159
160 if (file == nil) return nil;
161 lcName = [file lowercaseString];
162
163 if (folder != nil)
164 {
165 lcDirName = [folder lowercaseString];
166 realFileName = [[_directoryListings oo_dictionaryForKey:lcDirName] objectForKey:lcName];
167
168 if (realFileName != nil)
169 {
170 realDirName = [_directoryCases objectForKey:lcDirName];
171 path = [realDirName stringByAppendingPathComponent:realFileName];
172 }
173 }
174
175 if (path == nil)
176 {
177 realFileName = [[_directoryListings oo_dictionaryForKey:@""] objectForKey:lcName];
178
179 if (realFileName != nil)
180 {
181 path = realFileName;
182 }
183 }
184
185 if (path != nil)
186 {
187 [_usedFiles addObject:path];
188 if (realDirName != nil && ![realDirName isEqual:folder])
189 {
190 // Case mismatch for folder name
191 if (![_caseWarnings containsObject:lcDirName])
192 {
193 [_caseWarnings addObject:lcDirName];
194 OOLog(@"verifyOXP.files.caseMismatch", @"***** ERROR: case mismatch: directory '%@' should be called '%@'.", realDirName, folder);
195 }
196 }
197
198 if (![realFileName isEqual:file])
199 {
200 // Case mismatch for file name
201 if (![_caseWarnings containsObject:lcName])
202 {
203 [_caseWarnings addObject:lcName];
204
205 expectedPath = [self displayNameForFile:file andFolder:folder];
206
207 if (context != nil) context = [@" referenced in " stringByAppendingString:context];
208 else context = @"";
209
210 OOLog(@"verifyOXP.files.caseMismatch", @"***** ERROR: case mismatch: request for file '%@'%@ resolved to '%@'.", expectedPath, context, path);
211 }
212 }
213
214 return [_basePath stringByAppendingPathComponent:path];
215 }
216
217 // If we get here, the file wasn't found in the OXP.
218 // FIXME: should check case for built-in files.
219 if (checkBuiltIn) return [ResourceManager pathForFileNamed:file inFolder:folder];
220
221 return nil;
222}

◆ plistNamed:inFolder:referencedFrom:checkBuiltIn:

- (id) plistNamed: (NSString *) file
inFolder: (NSString *) folder
referencedFrom: (NSString *) context
checkBuiltIn: (BOOL) checkBuiltIn 

Definition at line 761 of file OOFileScannerVerifierStage.m.

239 :(NSString *)file
240 inFolder:(NSString *)folder
241 referencedFrom:(NSString *)context
242 checkBuiltIn:(BOOL)checkBuiltIn
243{
244 NSData *data = nil;
245 NSString *errorString = nil;
246 NSPropertyListFormat format;
247 id plist = nil;
248 NSArray *errorLines = nil;
249 NSEnumerator *errLineEnum = nil;
250 NSString *displayName = nil,
251 *errorKey = nil;
252 NSAutoreleasePool *pool = nil;
253
254 data = [self dataForFile:file inFolder:folder referencedFrom:context checkBuiltIn:checkBuiltIn];
255 if (data == nil) return nil;
256
257 pool = [[NSAutoreleasePool alloc] init];
258
259 plist = [NSPropertyListSerialization propertyListFromData:data
260 mutabilityOption:NSPropertyListImmutable
261 format:&format
262 errorDescription:&errorString];
263
264#if OOLITE_RELEASE_PLIST_ERROR_STRINGS
265 [errorString autorelease];
266#endif
267
268 if (plist != nil)
269 {
270 // PList is readable; check that it's in an official Oolite format.
271 [self checkPListFormat:format file:file folder:folder];
272 }
273 else
274 {
275 /* Couldn't parse plist; report problem.
276 This is complicated somewhat by the need to present a possibly
277 multi-line error description while maintaining our indentation.
278 */
279 displayName = [self displayNameForFile:file andFolder:folder];
280 errorKey = [displayName lowercaseString];
281 if (![_badPLists containsObject:errorKey])
282 {
283 [_badPLists addObject:errorKey];
284 OOLog(@"verifyOXP.plist.parseError", @"Could not interpret property list %@.", displayName);
285 OOLogIndent();
286 errorLines = [errorString componentsSeparatedByString:@"\n"];
287 for (errLineEnum = [errorLines objectEnumerator]; (errorString = [errLineEnum nextObject]); )
288 {
289 while ([errorString hasPrefix:@"\t"])
290 {
291 errorString = [@" " stringByAppendingString:[errorString substringFromIndex:1]];
292 }
293 OOLog(@"verifyOXP.plist.parseError", @"%@", errorString);
294 }
295 OOLogOutdent();
296 }
297 }
298
299 [plist retain];
300 [pool release];
301
302 return [plist autorelease];
303}
void OOLogOutdent(void)
Definition OOLogging.m:376
void OOLogIndent(void)
Definition OOLogging.m:366

◆ run

- (void) run
implementation

Reimplemented from OOOXPVerifierStage.

Definition at line 761 of file OOFileScannerVerifierStage.m.

107{
108 NSAutoreleasePool *pool = nil;
109
110 _usedFiles = [[NSMutableSet alloc] init];
111 _caseWarnings = [[NSMutableSet alloc] init];
112 _badPLists = [[NSMutableSet alloc] init];
113
114 pool = [[NSAutoreleasePool alloc] init];
115 [self scanForFiles];
116 [pool release];
117
118 pool = [[NSAutoreleasePool alloc] init];
119 [self checkRootFolders];
120 [self checkKnownFiles];
121 [pool release];
122}

◆ scanDirectory:

- (NSDictionary *) scanDirectory: (NSString *) path
implementation

Provided by category OOFileScannerVerifierStage(OOPrivate).

Definition at line 761 of file OOFileScannerVerifierStage.m.

548 :(NSString *)path
549{
550 NSDirectoryEnumerator *dirEnum = nil;
551 NSMutableDictionary *result = nil;
552 NSString *name = nil,
553 *lcName = nil,
554 *type = nil,
555 *dirName = nil,
556 *relativeName = nil,
557 *existing = nil;
558
559 result = [NSMutableDictionary dictionary];
560 dirName = [path lastPathComponent];
561
562 dirEnum = [[NSFileManager defaultManager] enumeratorAtPath:path];
563 while ((name = [dirEnum nextObject]))
564 {
565 type = [[dirEnum fileAttributes] fileType];
566 relativeName = [dirName stringByAppendingPathComponent:name];
567
568 if ([_junkFileNames containsObject:name])
569 {
570 OOLog(@"verifyOXP.scanFiles.skipJunk", @"NOTE: skipping junk file %@/%@.", dirName, name);
571 }
572 else if ([type isEqualToString:NSFileTypeRegular])
573 {
574 lcName = [name lowercaseString];
575 existing = [result objectForKey:lcName];
576
577 if (existing == nil)
578 {
579 OOLog(@"verifyOXP.verbose.listFiles", @"- %@", name);
580 [result setObject:name forKey:lcName];
581 }
582 else
583 {
584 OOLog(@"verifyOXP.scanFiles.overloadedName", @"***** ERROR: %@ '%@' conflicts with %@ named '%@', ignoring. (OXPs must work on case-insensitive file systems!)", @"file", relativeName, @"file", [dirName stringByAppendingPathComponent:existing]);
585 }
586 }
587 else
588 {
589 if ([type isEqualToString:NSFileTypeDirectory])
590 {
591 [dirEnum skipDescendents];
592 if (![_skipDirectoryNames containsObject:name])
593 {
594 OOLog(@"verifyOXP.scanFiles.directory", @"----- WARNING: \"%@\" is a nested directory, ignoring.", relativeName);
595 }
596 else
597 {
598 OOLog(@"verifyOXP.verbose.listFiles", @"- Skipping %@/%@/", dirName, name);
599 }
600 }
601 else if ([type isEqualToString:NSFileTypeSymbolicLink])
602 {
603 OOLog(@"verifyOXP.scanFiles.symLink", @"----- WARNING: \"%@\" is a symbolic link, ignoring.", relativeName);
604 }
605 else
606 {
607 OOLog(@"verifyOXP.scanFiles.nonStandardFile", @"----- WARNING: \"%@\" is a non-standard file (%@), ignoring.", relativeName, type);
608 }
609 }
610 }
611
612 return result;
613}

◆ scanForFiles

- (void) scanForFiles
implementation

Provided by category OOFileScannerVerifierStage(OOPrivate).

Definition at line 761 of file OOFileScannerVerifierStage.m.

325{
326 NSDirectoryEnumerator *dirEnum = nil;
327 NSString *name = nil,
328 *path = nil,
329 *type = nil,
330 *lcName = nil,
331 *existing = nil,
332 *existingType = nil;
333 NSMutableDictionary *directoryListings = nil,
334 *directoryCases = nil,
335 *rootFiles = 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 // Silently skip .svn and CVS
363 OOLog(@"verifyOXP.verbose.listFiles", @"- Skipping %@/", name);
364 }
365 else if (!CheckNameConflict(lcName, directoryCases, rootFiles, &existing, &existingType))
366 {
367 OOLog(@"verifyOXP.verbose.listFiles", @"- %@/", name);
368 OOLogIndentIf(@"verifyOXP.verbose.listFiles");
369 dirFiles = [self scanDirectory:path];
370 [directoryListings setObject:dirFiles forKey:lcName];
371 [directoryCases setObject:name forKey:lcName];
372 OOLogOutdentIf(@"verifyOXP.verbose.listFiles");
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)
Definition OOLogging.h:102
#define OOLogIndentIf(class)
Definition OOLogging.h:101

Member Data Documentation

◆ _badPLists

- (NSMutableSet*) _badPLists
private

Definition at line 44 of file OOFileScannerVerifierStage.h.

◆ _basePath

- (NSString*) _basePath
private

Definition at line 39 of file OOFileScannerVerifierStage.h.

◆ _caseWarnings

- (NSMutableSet*) _caseWarnings
private

Definition at line 41 of file OOFileScannerVerifierStage.h.

◆ _directoryCases

- (NSDictionary*) _directoryCases
private

Definition at line 43 of file OOFileScannerVerifierStage.h.

◆ _directoryListings

- (NSDictionary*) _directoryListings
private

Definition at line 42 of file OOFileScannerVerifierStage.h.

◆ _junkFileNames

- (NSSet*) _junkFileNames
private

Definition at line 45 of file OOFileScannerVerifierStage.h.

◆ _skipDirectoryNames

- (NSSet*) _skipDirectoryNames
private

Definition at line 46 of file OOFileScannerVerifierStage.h.

◆ _usedFiles

- (NSMutableSet*) _usedFiles
private

Definition at line 40 of file OOFileScannerVerifierStage.h.


The documentation for this class was generated from the following files: