janwas
78c751aff6
file: now provides a much more efficient alternative to file_enum that does not sort all files (this was a problem for check_if_oal_dll which was scanning the entire system32 dir) - use the same DirEnt struct for file and VFS due to clever name pointer trick. - wposix: avoid malloc for most opendir() and fix mmap() bugs (thanks to Philip for noticing+reporting them) - VFS: was getting too large to manage, now split into an additional file - WIP: much more efficient mounting; supports other mount sources than file or zip (e.g. if we want to add network files); clean separation between VFS submodules; dox; beginning of thread locking. This was SVN commit r2589.
29 lines
1.1 KiB
C
29 lines
1.1 KiB
C
#ifndef VFS_UTIL_H__
|
|
#define VFS_UTIL_H__
|
|
|
|
#include "lib.h"
|
|
|
|
// 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 int vfs_path_validate(const uint line, const char* path);
|
|
#define CHECK_PATH(path) CHECK_ERR(vfs_path_validate(__LINE__, path))
|
|
|
|
extern bool vfs_path_component_valid(const char* name);
|
|
|
|
// convenience function
|
|
extern void vfs_path_copy(char* dst, const char* src);
|
|
|
|
// combine <path1> and <path2> into one path, and write to <dst>.
|
|
// if necessary, a directory separator is added between the paths.
|
|
// each may be empty, filenames, or full paths.
|
|
// total path length (including '\0') must not exceed VFS_MAX_PATH.
|
|
extern int vfs_path_append(char* dst, const char* path1, const char* path2);
|
|
|
|
// strip <remove> from the start of <src>, prepend <replace>,
|
|
// and write to <dst>.
|
|
// used when converting VFS <--> real paths.
|
|
extern int vfs_path_replace(char* dst, const char* src, const char* remove, const char* replace);
|
|
|
|
#endif // #ifndef VFS_UTIL_H__
|