mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-06 17:46:15 +00:00
8667ea74c8
- directoryPosix: replace most methods with boost filesystem (but not all: the latter cannot efficiently enumerate files AND query their size/mtime) - AllocatorChecker: better name for member functions - file: move the File class here - trace: bugfix - io: move UnalignedWriter to write_buffer.cpp (basically the same thing) - vfs: remove unnecessary "vfs" warts from variable names - vfs_tree: VfsFile now stores single Name/Size/MTime fields instead of the FileInfo record (less clunky) - vfs_path: use boost filesystem's version of the basename/extension functions - lf_alloc: remove (no longer necessary, won't be finished - not worth the trouble) - path_util: remove path_foreach_component (replaced by better path traversal logic) and PathPackage (obsoleted by fs::path) ! resource loading code now receives VfsPath as its filename. there is also OsPath (native absolute path) and Path (relative to binaries/data) - tex is now independent of file loading code; it just en/decodes in-memory buffers - wdll_ver: clean up, use smart pointer to simplify bailout code - wsdl: remove nonexistent failure path from calc_gamma (cruised by here because SDL_SetGamme is failing once after a cold boot at work) - wsnd: simplify OpenAL DLL search, use boost::filesystem - wutil: Wow64 redirection is now packaged in a (RAII) class This was SVN commit r5525.
45 lines
1.0 KiB
C++
45 lines
1.0 KiB
C++
#ifndef INCLUDED_FILESYSTEM
|
|
#define INCLUDED_FILESYSTEM
|
|
|
|
#include "lib/path_util.h"
|
|
#include "lib/file/file.h"
|
|
#include "lib/file/io/io.h"
|
|
#include "lib/file/vfs/vfs.h"
|
|
#include "lib/file/file_system_util.h"
|
|
#include "lib/file/io/write_buffer.h"
|
|
|
|
#include "ps/CStr.h"
|
|
#include "ps/Errors.h"
|
|
|
|
extern PIVFS g_VFS;
|
|
|
|
extern bool FileExists(const char* pathname);
|
|
|
|
ERROR_GROUP(CVFSFile);
|
|
ERROR_TYPE(CVFSFile, LoadFailed);
|
|
ERROR_TYPE(CVFSFile, AlreadyLoaded);
|
|
ERROR_TYPE(CVFSFile, InvalidBufferAccess);
|
|
|
|
// Reads a file, then gives read-only access to the contents
|
|
class CVFSFile
|
|
{
|
|
public:
|
|
CVFSFile();
|
|
~CVFSFile();
|
|
|
|
// Returns either PSRETURN_OK or PSRETURN_CVFSFile_LoadFailed.
|
|
// Dies if a file has already been successfully loaded.
|
|
PSRETURN Load(const char* filename);
|
|
|
|
// These die if called when no file has been successfully loaded.
|
|
const u8* GetBuffer() const;
|
|
size_t GetBufferSize() const;
|
|
CStr GetAsString() const;
|
|
|
|
private:
|
|
shared_ptr<u8> m_Buffer;
|
|
size_t m_BufferSize;
|
|
};
|
|
|
|
#endif // #ifndef INCLUDED_FILESYSTEM
|