Remove mj_makeEmptyFileVFS and mj_findFileVFS from MuJoCo API.
PiperOrigin-RevId: 645393666 Change-Id: Iabe939c88f60b80dce20f84c7ff9a6396717cc84
This commit is contained in:
committed by
Copybara-Service
parent
14fe527ea2
commit
e66b9a36b2
@@ -6376,18 +6376,12 @@ public static unsafe extern int mj_addFileVFS(void* vfs, [MarshalAs(UnmanagedTyp
|
||||
[DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static unsafe extern int mj_addBufferVFS(void* vfs, [MarshalAs(UnmanagedType.LPStr)]string name, void* buffer, int nbuffer);
|
||||
|
||||
[DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static unsafe extern int mj_findFileVFS(void* vfs, [MarshalAs(UnmanagedType.LPStr)]string filename);
|
||||
|
||||
[DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static unsafe extern int mj_deleteFileVFS(void* vfs, [MarshalAs(UnmanagedType.LPStr)]string filename);
|
||||
|
||||
[DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static unsafe extern void mj_deleteVFS(void* vfs);
|
||||
|
||||
[DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static unsafe extern int mj_makeEmptyFileVFS(void* vfs, [MarshalAs(UnmanagedType.LPStr)]string filename, int filesize);
|
||||
|
||||
[DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static unsafe extern mjModel_* mj_loadXML([MarshalAs(UnmanagedType.LPStr)]string filename, void* vfs, StringBuilder error, int error_sz);
|
||||
|
||||
|
||||
@@ -59,20 +59,8 @@ public sealed class MjVfs : IDisposable {
|
||||
}
|
||||
}
|
||||
|
||||
// Searches the VFS for the specified file and returns its index.
|
||||
// The index then can be used to retrieve the file contents from Data.filedata array.
|
||||
public unsafe int FindFile(string filename) {
|
||||
return mj_findFileVFS(_unmanagedVfs.ToPointer(), filename);
|
||||
}
|
||||
|
||||
// Loads a model from the specified file.
|
||||
// The file is assumed to be located in the filesystem. If it's not found, the method will throw
|
||||
// an ArgumentException.
|
||||
public unsafe MujocoLib.mjModel_* LoadXML(string filename) {
|
||||
if (FindFile(filename) < 0) {
|
||||
throw new ArgumentException($"File {filename} was not added to the VFS.");
|
||||
}
|
||||
|
||||
var errorBuf = new StringBuilder(1024);
|
||||
MujocoLib.mjModel_* model = MujocoLib.mj_loadXML(
|
||||
filename, _unmanagedVfs.ToPointer(), errorBuf, errorBuf.Capacity);
|
||||
|
||||
@@ -42,12 +42,5 @@ namespace Mujoco {
|
||||
_vfs.AddFile(filename, contents);
|
||||
Assert.That(_vfs.FilesCount, Is.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public unsafe void LocatingFileUsingMujocoLib() {
|
||||
var filename = "filename";
|
||||
_vfs.AddFile(filename, "contents");
|
||||
Assert.That(_vfs.FindFile(filename), Is.EqualTo(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user