Oolite 1.91.0.7604-240417-a536cbe
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{
38@private
39 NSString *_basePath;
40 NSMutableSet *_usedFiles;
41 NSMutableSet *_caseWarnings;
42 NSDictionary *_directoryListings;
43 NSDictionary *_directoryCases;
44 NSMutableSet *_badPLists;
47}
48
49// Returns name to be used in -dependencies by other stages; also registers stage.
50+ (NSString *)nameForDependencyForVerifier:(OOOXPVerifier *)verifier;
51
52/* This method does the following:
53 A. Checks whether a file exists.
54 B. Checks whether case matches, and logs a warning otherwise.
55 C. Maintains list of files which are referred to.
56 D. Optionally falls back on Oolite's built-in files.
57
58 For example, to test whether a texture referenced in a shipdata.plist entry
59 exists, one would use:
60 [fileScanner fileExists:textureName inFolder:@"Textures" referencedFrom:@"shipdata.plist" checkBuiltIn:YES];
61*/
62- (BOOL)fileExists:(NSString *)file
63 inFolder:(NSString *)folder
64 referencedFrom:(NSString *)context
65 checkBuiltIn:(BOOL)checkBuiltIn;
66
67// This method performs all the checks the previous one does, but also returns a file path.
68- (NSString *)pathForFile:(NSString *)file
69 inFolder:(NSString *)folder
70 referencedFrom:(NSString *)context
71 checkBuiltIn:(BOOL)checkBuiltIn;
72
73// Data getters based on above method.
74- (NSData *)dataForFile:(NSString *)file
75 inFolder:(NSString *)folder
76 referencedFrom:(NSString *)context
77 checkBuiltIn:(BOOL)checkBuiltIn;
78
79- (id)plistNamed:(NSString *)file // Only uses "real" plist parser, not homebrew.
80 inFolder:(NSString *)folder
81 referencedFrom:(NSString *)context
82 checkBuiltIn:(BOOL)checkBuiltIn;
83
84
85/* Utility to handle display names of files.
86 If a file and folder are provided, returns folder/file, otherwise just file.
87*/
88- (id)displayNameForFile:(NSString *)file andFolder:(NSString *)folder;
89
90/* Get a list of files in a subfolder of the OXP. Order is undefined.
91*/
92- (NSArray *)filesInFolder:(NSString *)folder;
93
94@end
95
96
98
99// Returns name to be used in -dependents by other stages; also registers stage.
100+ (NSString *)nameForReverseDependencyForVerifier:(OOOXPVerifier *)verifier;
101
102@end
103
104
106
108
109@end
110
111
112// Convenience base class for stages that require OOFileScannerVerifierStage and OOListUnusedFilesStage.
114
115@end
116
117#endif