mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-13 17:00:19 +00:00
Make packed fs always available, and manually settable
This commit is contained in:
1 parent
06f525713f
commit
25dc078af7
83 files changed
+289
-8052
No files matched your search
@@ -44,7 +44,28 @@ struct mg_str mg_file_read(struct mg_fs *fs, const char *path);
|
||||
bool mg_file_write(struct mg_fs *fs, const char *path, const void *, size_t);
|
||||
bool mg_file_printf(struct mg_fs *fs, const char *path, const char *fmt, ...);
|
||||
|
||||
// Packed API
|
||||
const char *mg_unpack(const char *path, size_t *size, time_t *mtime);
|
||||
const char *mg_unlist(size_t no); // Get no'th packed filename
|
||||
|
||||
// A piece of memory (flash or RAM) represented as a file
|
||||
struct mg_mem_file {
|
||||
const char *path;
|
||||
const unsigned char *data;
|
||||
size_t size; // Data size
|
||||
time_t mtime; // Modification time
|
||||
};
|
||||
|
||||
// Global variable that points to the array of memory files. It can be
|
||||
// changed to point to the user-defined file array. The last element
|
||||
// should have NULL path.
|
||||
//
|
||||
// static const struct mg_mem_file my_files[] = {
|
||||
// {"/web_root/index.html", "hi", 2, 0},
|
||||
// {NULL, NULL, 0, 0},
|
||||
// };
|
||||
// mg_mem_files = my_files;
|
||||
extern const struct mg_mem_file *mg_mem_files;
|
||||
|
||||
// const char *mg_unpack(const char *path, size_t *size, time_t *mtime);
|
||||
// const char *mg_unlist(size_t no); // Get no'th packed filename
|
||||
struct mg_str mg_unpacked(const char *path); // Packed file as mg_str
|
||||
|
||||
extern const struct mg_mem_file mg_packed_files[]; // Generated by "pack" util
|
||||
Reference in new issue
Block a user