You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typedef std::map<AsciiString, AsciiString> ArchivedFileLocationMap; //first string is the file name, second one is the archive filename.
87
+
typedef std::map<AsciiString, DetailedArchivedDirectoryInfo> DetailedArchivedDirectoryInfoMap;// Archived directory name to detailed archived directory info
88
+
typedef std::map<AsciiString, ArchivedDirectoryInfo> ArchivedDirectoryInfoMap;// Archived directory name to archived directory info
89
+
typedef std::map<AsciiString, ArchivedFileInfo> ArchivedFileInfoMap;// Archived file name to archived file info
90
+
typedef std::map<AsciiString, ArchiveFile *> ArchiveFileMap;// Archive file name to archive data
91
+
typedef std::multimap<AsciiString, ArchiveFile *> ArchivedFileLocationMap; //Archived file name to archive data
92
92
93
93
classArchivedDirectoryInfo
94
94
{
95
95
public:
96
-
AsciiString m_directoryName;
97
-
ArchivedDirectoryInfoMap m_directories;
98
-
ArchivedFileLocationMap m_files;
99
-
100
-
voidclear()
101
-
{
102
-
m_directoryName.clear();
103
-
m_directories.clear();
104
-
m_files.clear();
105
-
}
106
-
96
+
AsciiString m_path; // The full path to this directory
97
+
AsciiString m_directoryName; // The current directory
@@ -112,13 +105,6 @@ class DetailedArchivedDirectoryInfo
112
105
AsciiString m_directoryName;
113
106
DetailedArchivedDirectoryInfoMap m_directories;
114
107
ArchivedFileInfoMap m_files;
115
-
116
-
voidclear()
117
-
{
118
-
m_directoryName.clear();
119
-
m_directories.clear();
120
-
m_files.clear();
121
-
}
122
108
};
123
109
124
110
classArchivedFileInfo
@@ -130,23 +116,16 @@ class ArchivedFileInfo
130
116
UnsignedInt m_size;
131
117
132
118
ArchivedFileInfo()
119
+
: m_offset(0)
120
+
, m_size(0)
133
121
{
134
-
clear();
135
-
}
136
-
137
-
voidclear()
138
-
{
139
-
m_filename.clear();
140
-
m_archiveFilename.clear();
141
-
m_offset = 0;
142
-
m_size = 0;
143
122
}
144
123
};
145
124
146
125
147
126
classArchiveFileSystem : publicSubsystemInterface
148
127
{
149
-
public:
128
+
public:
150
129
ArchiveFileSystem();
151
130
virtual~ArchiveFileSystem();
152
131
@@ -158,24 +137,38 @@ class ArchiveFileSystem : public SubsystemInterface
158
137
// ArchiveFile operations
159
138
virtual ArchiveFile* openArchiveFile( const Char *filename ) = 0; ///< Create new or return existing Archive file from file name
160
139
virtualvoidcloseArchiveFile( const Char *filename ) = 0; ///< Close the one specified big file.
161
-
virtualvoidcloseAllArchiveFiles( void ) = 0; ///< Close all Archivefiles currently open
140
+
virtualvoidcloseAllArchiveFiles( void ) = 0; ///< Close all Archive files currently open
162
141
163
142
// File operations
164
-
virtual File* openFile( const Char *filename, Int access = 0); ///< Search Archive files for specified file name and open it if found
165
-
virtualvoidcloseAllFiles( void ) = 0; ///< Close all files associated with ArchiveFiles
166
-
virtual Bool doesFileExist(const Char *filename) const;///< return true if that file exists in an archive file somewhere.
143
+
virtual File* openFile( const Char *filename, Int access = 0, FileInstance instance = 0); ///< Search Archive files for specified file name and open it if found
144
+
virtualvoidcloseAllFiles( void ) = 0; ///< Close all files associated with Archive files
145
+
virtual Bool doesFileExist(const Char *filename, FileInstance instance = 0) const; ///< return true if that file exists in an archive file somewhere.
167
146
168
147
voidgetFileListInDirectory(const AsciiString& currentDirectory, const AsciiString& originalDirectory, const AsciiString& searchName, FilenameList &filenameList, Bool searchSubdirectories) const; ///< search the given directory for files matching the searchName (egs. *.ini, *.rep). Possibly search subdirectories. Scans each Archive file.
169
-
Bool getFileInfo(const AsciiString& filename, FileInfo *fileInfo) const; ///< see FileSystem.h
virtualvoidloadIntoDirectoryTree(const ArchiveFile *archiveFile, const AsciiString& archiveFilename, Bool overwrite = FALSE ); ///< load the archive file's header information and apply it to the global archive directory tree.
160
+
structArchivedDirectoryInfoResult
161
+
{
162
+
ArchivedDirectoryInfoResult() : dirInfo(NULL) {}
163
+
Bool valid() const { return dirInfo != NULL; }
164
+
165
+
ArchivedDirectoryInfo* dirInfo;
166
+
AsciiString lastToken; ///< Synonymous for file name if the search directory was a file path
virtualvoidloadIntoDirectoryTree(ArchiveFile *archiveFile, Bool overwrite = FALSE); ///< load the archive file's header information and apply it to the global archive directory tree.
// Can be used to access different versions of files in different archives under the same name.
133
+
// Instance 0 refers to the top file that shadows all other files under the same name.
121
134
//===============================
122
-
123
135
classFileSystem : publicSubsystemInterface
124
136
{
125
137
FileSystem(const FileSystem&);
@@ -133,23 +145,30 @@ class FileSystem : public SubsystemInterface
133
145
voidreset();
134
146
voidupdate();
135
147
136
-
File* openFile( const Char *filename, Int access = File::NONE, size_t bufferSize = File::BUFFERSIZE ); ///< opens a File interface to the specified file
137
-
Bool doesFileExist(const Char *filename) const;///< returns TRUE if the file exists. filename should have no directory.
148
+
File* openFile( const Char *filename, Int access = File::NONE, size_t bufferSize = File::BUFFERSIZE, FileInstance instance = 0 ); ///< opens a File interface to the specified file
149
+
Bool doesFileExist(const Char *filename, FileInstance instance = 0) const;///< returns TRUE if the file exists. filename should have no directory.
138
150
voidgetFileListInDirectory(const AsciiString& directory, const AsciiString& searchName, FilenameList &filenameList, Bool searchSubdirectories) const; ///< search the given directory for files matching the searchName (egs. *.ini, *.rep). Possibly search subdirectories.
139
-
Bool getFileInfo(const AsciiString& filename, FileInfo *fileInfo) const; ///< fills in the FileInfo struct for the file given. returns TRUE if successful.
151
+
Bool getFileInfo(const AsciiString& filename, FileInfo *fileInfo, FileInstance instance = 0) const; ///< fills in the FileInfo struct for the file given. returns TRUE if successful.
140
152
141
153
Bool createDirectory(AsciiString directory); ///< create a directory of the given name.
142
154
143
155
Bool areMusicFilesOnCD();
144
156
voidloadMusicFilesFromCD();
145
157
voidunloadMusicFilesFromCD();
146
-
AsciiString normalizePath(const AsciiString& path) const; ///< normalizes a file path. The path can refer to a directory. File path must be absolute, but does not need to exist. Returns an empty string on failure.
158
+
159
+
static AsciiString normalizePath(const AsciiString& path); ///< normalizes a file path. The path can refer to a directory. File path must be absolute, but does not need to exist. Returns an empty string on failure.
147
160
static Bool isPathInDirectory(const AsciiString& testPath, const AsciiString& basePath); ///< determines if a file path is within a base path. Both paths must be absolute, but do not need to exist.
0 commit comments