Skip to content

Commit

Permalink
feat(Vfs): add Vfs::save API
Browse files Browse the repository at this point in the history
  • Loading branch information
lmichaelis committed Mar 6, 2024
1 parent 53d7fdd commit f187c72
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/zenkit-capi/Vfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ typedef ZkBool (*ZkVfsNodeEnumerator)(void* ctx, ZkVfsNode const* node);

ZKC_API ZkVfs* ZkVfs_new(void);
ZKC_API void ZkVfs_del(ZkVfs* slf);
ZKC_API void ZkVfs_save(ZkVfs const* slf, ZkString path, ZkGameVersion version);

ZKC_API ZkVfsNode const* ZkVfs_getRoot(ZkVfs const* slf);

Expand Down
8 changes: 8 additions & 0 deletions src/Vfs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ void ZkVfs_del(ZkVfs* slf) {
delete slf;
}

void ZkVfs_save(ZkVfs const* slf, ZkString path, ZkGameVersion version) {
ZKC_TRACE_FN();
ZKC_CHECK_NULLV(slf, path);

auto wr = zenkit::Write::to(path);
slf->save(wr.get(), static_cast<zenkit::GameVersion>(version));
}

ZkVfsNode const* ZkVfs_getRoot(ZkVfs const* slf) {
ZKC_TRACE_FN();
ZKC_CHECK_NULL(slf);
Expand Down

0 comments on commit f187c72

Please sign in to comment.