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:
committed by
Copybara-Service
parent
82e85e24e5
commit
95167fab2d
@@ -15,7 +15,6 @@
|
||||
#include "engine/engine_vfs.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "engine/engine_array_safety.h"
|
||||
#include "engine/engine_plugin.h"
|
||||
@@ -72,11 +71,8 @@ int mj_addFileVFS(mjVFS* vfs, const char* directory, const char* filename) {
|
||||
|
||||
// make full name
|
||||
char fullname[1000];
|
||||
if (directory) {
|
||||
mjSTRNCPY(fullname, directory);
|
||||
mjSTRNCAT(fullname, filename);
|
||||
} else {
|
||||
mjSTRNCPY(fullname, filename);
|
||||
if (mju_makefullname(fullname, sizeof(fullname), directory, filename)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// strip path
|
||||
|
||||
Reference in New Issue
Block a user