Oolite
Loading...
Searching...
No Matches
OOFileScannerVerifierStage.h
Go to the documentation of this file.
1/*
2
3OOFileScannerVerifierStage.h
4
5OOOXPVerifierStage which keeps track of which files are used and ensures file
6name capitalization is consistent. It also provides the file lookup service
7for other stages.
8
9
10Copyright (C) 2007-2013 Jens Ayton
11
12Permission is hereby granted, free of charge, to any person obtaining a copy
13of this software and associated documentation files (the "Software"), to deal
14in the Software without restriction, including without limitation the rights
15to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16copies of the Software, and to permit persons to whom the Software is
17furnished to do so, subject to the following conditions:
18
19The above copyright notice and this permission notice shall be included in all
20copies or substantial portions of the Software.
21
22THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28SOFTWARE.
29
30*/
31
33
34#if OO_OXP_VERIFIER_ENABLED
35
37@private
38 NSString* _basePath;
39 NSMutableSet* _usedFiles;
40 NSMutableSet* _caseWarnings;
41 NSDictionary* _directoryListings;
42 NSDictionary* _directoryCases;
43 NSMutableSet* _badPLists;
46}
47
48// Returns name to be used in -dependencies by other stages; also registers stage.
49+ (NSString*)nameForDependencyForVerifier:(OOOXPVerifier*)verifier;
50
51/* This method does the following:
52 A. Checks whether a file exists.
53 B. Checks whether case matches, and logs a warning otherwise.
54 C. Maintains list of files which are referred to.
55 D. Optionally falls back on Oolite's built-in files.
56
57 For example, to test whether a texture referenced in a shipdata.plist entry
58 exists, one would use:
59 [fileScanner fileExists:textureName inFolder:@"Textures" referencedFrom:@"shipdata.plist" checkBuiltIn:YES];
60*/
61- (BOOL)fileExists:(NSString*)file
62 inFolder:(NSString*)folder
63 referencedFrom:(NSString*)context
64 checkBuiltIn:(BOOL)checkBuiltIn;
65
66// This method performs all the checks the previous one does, but also returns a file path.
67- (NSString*)pathForFile:(NSString*)file
68 inFolder:(NSString*)folder
69 referencedFrom:(NSString*)context
70 checkBuiltIn:(BOOL)checkBuiltIn;
71
72// Data getters based on above method.
73- (NSData*)dataForFile:(NSString*)file
74 inFolder:(NSString*)folder
75 referencedFrom:(NSString*)context
76 checkBuiltIn:(BOOL)checkBuiltIn;
77
78- (id)plistNamed:(NSString*)file // Only uses "real" plist parser, not homebrew.
79 inFolder:(NSString*)folder
80 referencedFrom:(NSString*)context
81 checkBuiltIn:(BOOL)checkBuiltIn;
82
83/* Utility to handle display names of files.
84 If a file and folder are provided, returns folder/file, otherwise just file.
85*/
86- (id)displayNameForFile:(NSString*)file andFolder:(NSString*)folder;
87
88/* Get a list of files in a subfolder of the OXP. Order is undefined.
89 */
90- (NSArray*)filesInFolder:(NSString*)folder;
91
92@end
93
95
96// Returns name to be used in -dependents by other stages; also registers stage.
97+ (NSString*)nameForReverseDependencyForVerifier:(OOOXPVerifier*)verifier;
98
99@end
100
101@interface OOOXPVerifier (OOFileScannerVerifierStage)
102
104
105@end
106
107// Convenience base class for stages that require OOFileScannerVerifierStage and OOListUnusedFilesStage.
109
110@end
111
112#endif