Add VFS handling logic to mj_openResource.

PiperOrigin-RevId: 653124909
Change-Id: I4d031eb0bfb0070f8493753d2aeaac60ac283b85
This commit is contained in:
Kyle Bayes
2024-07-17 00:40:20 -07:00
committed by Copybara-Service
parent 7f46e936f6
commit 2cf352c2e6
13 changed files with 244 additions and 247 deletions
+2 -7
View File
@@ -30,7 +30,8 @@ extern "C" {
// open the given resource; if the name doesn't have a prefix matching with a
// resource provider, then the OS filesystem is used
MJAPI mjResource* mju_openResource(const char* name, char* error, std::size_t nerror);
MJAPI mjResource* mju_openResource(const char* name, const mjVFS* vfs,
char* error, std::size_t nerror);
// close the given resource; no-op if resource is NULL
MJAPI void mju_closeResource(mjResource* resource);
@@ -47,14 +48,8 @@ MJAPI void mju_getResourceDir(mjResource* resource, const char** dir, int* ndir)
// return < 0 if the resource is older than the given timestamp
MJAPI int mju_isModifiedResource(const mjResource* resource, const char* timestamp);
// get the length of the dirname portion of a given path
MJAPI int mju_dirnamelen(const char* path);
#ifdef __cplusplus
}
#endif
// read file into memory buffer (allocated here with mju_malloc)
std::vector<uint8_t> mju_fileToMemory(const char* filename);
#endif // MUJOCO_SRC_ENGINE_ENGINE_RESOURCE_H_