|
@@ -65,45 +65,45 @@ public:
|
|
|
|
|
|
uint Scan(const char *extension, Subdirectory sd, bool tars = true, bool recursive = true);
|
|
|
uint Scan(const char *extension, const char *directory, bool recursive = true);
|
|
|
|
|
|
/**
|
|
|
* Add a file with the given filename.
|
|
|
* @param filename the full path to the file to read
|
|
|
* @param basepath_length amount of characters to chop of before to get a
|
|
|
* filename relative to the search path.
|
|
|
* @param tar_filename the name of the tar file the file is read from.
|
|
|
* @return true if the file is added.
|
|
|
*/
|
|
|
virtual bool AddFile(const char *filename, size_t basepath_length, const char *tar_filename) = 0;
|
|
|
virtual bool AddFile(const std::string &filename, size_t basepath_length, const std::string &tar_filename) = 0;
|
|
|
};
|
|
|
|
|
|
/** Helper for scanning for files with tar as extension */
|
|
|
class TarScanner : FileScanner {
|
|
|
uint DoScan(Subdirectory sd);
|
|
|
public:
|
|
|
/** The mode of tar scanning. */
|
|
|
enum Mode {
|
|
|
NONE = 0, ///< Scan nothing.
|
|
|
BASESET = 1 << 0, ///< Scan for base sets.
|
|
|
NEWGRF = 1 << 1, ///< Scan for non-base sets.
|
|
|
AI = 1 << 2, ///< Scan for AIs and its libraries.
|
|
|
SCENARIO = 1 << 3, ///< Scan for scenarios and heightmaps.
|
|
|
GAME = 1 << 4, ///< Scan for game scripts.
|
|
|
ALL = BASESET | NEWGRF | AI | SCENARIO | GAME, ///< Scan for everything.
|
|
|
};
|
|
|
|
|
|
bool AddFile(const char *filename, size_t basepath_length, const char *tar_filename = nullptr) override;
|
|
|
bool AddFile(const std::string &filename, size_t basepath_length, const std::string &tar_filename = nullptr) override;
|
|
|
|
|
|
bool AddFile(Subdirectory sd, const char *filename);
|
|
|
bool AddFile(Subdirectory sd, const std::string &filename);
|
|
|
|
|
|
/** Do the scan for Tars. */
|
|
|
static uint DoScan(TarScanner::Mode mode);
|
|
|
};
|
|
|
|
|
|
DECLARE_ENUM_AS_BIT_SET(TarScanner::Mode)
|
|
|
|
|
|
/* Implementation of opendir/readdir/closedir for Windows */
|
|
|
#if defined(_WIN32)
|
|
|
struct DIR;
|
|
|
|
|
|
struct dirent { // XXX - only d_name implemented
|