Add utility function for merging directory names with filenames, and fix issue in mj_addfileVFS where directory names without trailing filesystem separators won't append correctly.

PiperOrigin-RevId: 545450158
Change-Id: I550394f11ac2837d35f3d869f8718a119a9eac38
This commit is contained in:
Kyle Bayes
2023-07-04 08:08:14 -07:00
committed by Copybara-Service
parent 82e85e24e5
commit 95167fab2d
6 changed files with 147 additions and 9 deletions
+2 -1
View File
@@ -1046,7 +1046,8 @@ mj_addFileVFS
.. mujoco-include:: mj_addFileVFS
Add file to VFS, return 0: success, 1: full, 2: repeated name, -1: failed to load.
Add file to VFS. The directory argument is optional and can be NULL or empty. Returns 0 on success, 1 when VFS is full,
2 on name collision, or -1 when an internal error occurs.
.. _mj_makeEmptyFileVFS:
+5
View File
@@ -22,6 +22,11 @@ this data structure. The common usage pattern is to first clear it with mj_defau
mj_addFileVFS (which allocates memory buffers and loads the file content in memory), then call mj_loadXML or
mj_loadModel, and then clear everything with mj_deleteVFS.
.. _mj_addFileVFS:
Add file to VFS. The directory argument is optional and can be NULL or empty. Returns 0 on success, 1 when VFS is full,
2 on name collision, or -1 when an internal error occurs.
.. _Parseandcompile:
The key function here is :ref:`mj_loadXML`. It invokes the built-in parser and compiler, and either returns a pointer to