equal
deleted
inserted
replaced
38 |
38 |
39 /** |
39 /** |
40 * Types of searchpaths OpenTTD might use |
40 * Types of searchpaths OpenTTD might use |
41 */ |
41 */ |
42 enum Searchpath { |
42 enum Searchpath { |
43 SP_WORKING_DIR, ///< Search in the working directory |
43 SP_FIRST_DIR, |
44 SP_PERSONAL_DIR, ///< Search in the personal directory |
44 SP_WORKING_DIR = SP_FIRST_DIR, ///< Search in the working directory |
45 SP_SHARED_DIR, ///< Search in the shared directory, like 'Shared Files' under Windows |
45 SP_PERSONAL_DIR, ///< Search in the personal directory |
46 SP_BINARY_DIR, ///< Search in the directory where the binary resides |
46 SP_SHARED_DIR, ///< Search in the shared directory, like 'Shared Files' under Windows |
47 SP_INSTALLATION_DIR, ///< Search in the installation directory |
47 SP_BINARY_DIR, ///< Search in the directory where the binary resides |
48 SP_APPLICATION_BUNDLE_DIR, ///< Search within the application bundle |
48 SP_INSTALLATION_DIR, ///< Search in the installation directory |
|
49 SP_APPLICATION_BUNDLE_DIR, ///< Search within the application bundle |
49 NUM_SEARCHPATHS |
50 NUM_SEARCHPATHS |
50 }; |
51 }; |
51 |
52 |
52 DECLARE_POSTFIX_INCREMENT(Searchpath); |
53 DECLARE_POSTFIX_INCREMENT(Searchpath); |
53 |
54 |
68 { |
69 { |
69 return sp < NUM_SEARCHPATHS && _searchpaths[sp] != NULL; |
70 return sp < NUM_SEARCHPATHS && _searchpaths[sp] != NULL; |
70 } |
71 } |
71 |
72 |
72 /** Iterator for all the search paths */ |
73 /** Iterator for all the search paths */ |
73 #define FOR_ALL_SEARCHPATHS(sp) for (sp = SP_PERSONAL_DIR; sp < NUM_SEARCHPATHS; sp++) if (IsValidSearchPath(sp)) |
74 #define FOR_ALL_SEARCHPATHS(sp) for (sp = SP_FIRST_DIR; sp < NUM_SEARCHPATHS; sp++) if (IsValidSearchPath(sp)) |
74 |
75 |
75 FILE *FioFOpenFile(const char *filename, const char *mode = "rb", Subdirectory subdir = DATA_DIR); |
76 FILE *FioFOpenFile(const char *filename, const char *mode = "rb", Subdirectory subdir = DATA_DIR); |
76 bool FioCheckFileExists(const char *filename, Subdirectory subdir = DATA_DIR); |
77 bool FioCheckFileExists(const char *filename, Subdirectory subdir = DATA_DIR); |
77 char *FioGetFullPath(char *buf, size_t buflen, Searchpath sp, Subdirectory subdir, const char *filename); |
78 char *FioGetFullPath(char *buf, size_t buflen, Searchpath sp, Subdirectory subdir, const char *filename); |
78 char *FioFindFullPath(char *buf, size_t buflen, Subdirectory subdir, const char *filename); |
79 char *FioFindFullPath(char *buf, size_t buflen, Subdirectory subdir, const char *filename); |