forked from 0ad/0ad
janwas
0fd85b76db
- allocators.cpp: fix: make sure all pool fields are reset in pool_free_all; correct matrix self-test - lib: fix self-test - lib_error: give "informational" return codes values > 100 (allows multiplexing with percent indicator) - archive: add clarification to afile_enum; use vfs_load when building archive (fixes caching problem); add support for progressive archive creation - file: allow pp_set_dir's path to end in slash (simplifies other code); add file_exists - file_cache: add stats+sanity checks to allocator; improve ExtantBufMgr find(); add ExactBufOracle to translate padded address returned by Cache to what was actually allocated; relax infinite-loop check; fix file_cache_reset - file_io: refactor callback logic so it can be used by vfs (needed for vfs_load) - vfs: vfs_load now supports calling back (required for archive builder) - vfs_mount: optimize path caching in afile_cb: due to atom_fn system, string compare can be done via pointer compare - vfs_optimizer: support auto-build of archive (progressive); improve should-build-archive check (WIP) - vfs_path: add util functions (also used in screenshot code) - vfs_tree: simplify pathname storage - wposix: mmap bugfix - main: call progressive archive builder; skip reload when doing so (documented) - JSInterface_VFS+scriptglue: add archiveBuilderCancel - ps/Util: use new vfs_path helper function for cleverer screenshot naming (correctly handles some being deleted) This was SVN commit r3578.
59 lines
2.0 KiB
C++
59 lines
2.0 KiB
C++
// JSInterface_VFS.h
|
|
//
|
|
// The JavaScript wrapper around useful snippets of the VFS
|
|
|
|
#ifndef JSI_VFS_INCLUDED
|
|
#define JSI_VFS_INCLUDED
|
|
|
|
#include "scripting/ScriptingHost.h"
|
|
|
|
// [KEEP IN SYNC WITH TDD AND WIKI]
|
|
|
|
// these are registered in ScriptGlue.cpp, hence the need for a header.
|
|
|
|
namespace JSI_VFS
|
|
{
|
|
// Return an array of pathname strings, one for each matching entry in the
|
|
// specified directory.
|
|
//
|
|
// pathnames = buildFileList(start_path [, filter_string [, recursive ] ]);
|
|
// directory: VFS path
|
|
// filter_string: default "" matches everything; otherwise, see vfs_next_dirent.
|
|
// recurse: should subdirectories be included in the search? default false.
|
|
//
|
|
// note: full pathnames of each file/subdirectory are returned,
|
|
// ready for use as a "filename" for the other functions.
|
|
JSBool BuildFileList( JSContext* cx, JSObject* obj, uintN argc, jsval* argv, jsval* rval );
|
|
|
|
// Return time [seconds since 1970] of the last modification to the specified file.
|
|
//
|
|
// mtime = getFileMTime(filename);
|
|
// filename: VFS filename (may include path)
|
|
JSBool GetFileMTime( JSContext* cx, JSObject* obj, uintN argc, jsval* argv, jsval* rval );
|
|
|
|
// Return current size of file.
|
|
//
|
|
// size = getFileSize(filename);
|
|
// filename: VFS filename (may include path)
|
|
JSBool GetFileSize( JSContext* cx, JSObject* obj, uintN argc, jsval* argv, jsval* rval );
|
|
|
|
// Return file contents in a string.
|
|
//
|
|
// contents = readFile(filename);
|
|
// filename: VFS filename (may include path)
|
|
JSBool ReadFile( JSContext* cx, JSObject* obj, uintN argc, jsval* argv, jsval* rval );
|
|
|
|
// Return file contents as an array of lines.
|
|
//
|
|
// lines = readFileLines(filename);
|
|
// filename: VFS filename (may include path)
|
|
JSBool ReadFileLines( JSContext* cx, JSObject* obj, uintN argc, jsval* argv, jsval* rval );
|
|
|
|
// Abort the current archive build operation (no-op if not currently active).
|
|
//
|
|
// archiveBuilderCancel();
|
|
JSBool ArchiveBuilderCancel(JSContext* cx, JSObject* obj, uintN argc, jsval* argv, jsval* rval );
|
|
};
|
|
|
|
#endif
|