forked from 0ad/0ad
janwas
06412a7751
archive: afile_read bugfix (wasn't returning byte count) byte_order: add to_leXX, implement read_leXX in terms of that, add write_leXX (and also big-endian versions) compression: support 0 length buffers + minor fixes file: no longer support passing fn_len (that didn't work anyway due to DynHashTbl find(const char*) interface); add FILE_DONT_SET_FN optimization that prevents cluttering name cache. file_cache: add logic to verify load/free/load/free sequence; add FILE_LONG_LIVED flag to specify exceptions (e.g. XMB files that don't free their buffer immediately) vfs_mount/vfs_tree: bugfix (was mixing up portable and VFS paths) vfs_optimizer: small fixes; creating Zip files now works vfs_tree: add PathName that stores pointer to path and name component for efficiency + convenience zip: bugfixes (wasn't endian safe; incorrect handling of cmethod; forgot to initialize ZipArchive members) config: add -buildarchive flag Xeromyces.cpp, FileUnpacker.cpp: add FILE_LONG_LIVED mapreader: bump time estimate for ReadXML This was SVN commit r3446.
31 lines
881 B
C
31 lines
881 B
C
#ifndef VFS_PATH_H__
|
|
#define VFS_PATH_H__
|
|
|
|
#include "lib.h"
|
|
|
|
// internal use only:
|
|
|
|
// if path is invalid (see source for criteria), print a diagnostic message
|
|
// (indicating line number of the call that failed) and
|
|
// return a negative error code. used by CHECK_PATH.
|
|
extern LibError path_validate(const uint line, const char* path);
|
|
#define CHECK_PATH(path) CHECK_ERR(path_validate(__LINE__, path))
|
|
|
|
extern bool path_component_valid(const char* name);
|
|
|
|
// strip <remove> from the start of <src>, prepend <replace>,
|
|
// and write to <dst>.
|
|
// used when converting VFS <--> real paths.
|
|
extern LibError path_replace(char* dst, const char* src, const char* remove, const char* replace);
|
|
|
|
|
|
struct PathName
|
|
{
|
|
const char* path;
|
|
const char* name;
|
|
};
|
|
|
|
extern LibError pathname_split(const char* V_path_tmp, PathName* V_path);
|
|
|
|
#endif // #ifndef VFS_PATH_H__
|