Retrieve the binary only when the MuJoCo package is installed.
PiperOrigin-RevId: 461524833 Change-Id: Ie8ca9dda71b35262f99688d02f71be77c251ea3e
This commit is contained in:
committed by
Copybara-Service
parent
0180d839a9
commit
e8a9db82b8
@@ -30,30 +30,34 @@ public class MujocoBinaryRetriever {
|
|||||||
|
|
||||||
static void RegisteredPackagesEventHandler(
|
static void RegisteredPackagesEventHandler(
|
||||||
PackageRegistrationEventArgs packageRegistrationEventArgs) {
|
PackageRegistrationEventArgs packageRegistrationEventArgs) {
|
||||||
var mujocoPath = packageRegistrationEventArgs.added[0].assetPath;
|
foreach (var packageInfo in packageRegistrationEventArgs.added) {
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) {
|
if (packageInfo.name.Equals("org.mujoco")) {
|
||||||
if (AssetDatabase.LoadMainAssetAtPath(mujocoPath + "/mujoco.dylib") == null) {
|
var mujocoPath = packageInfo.assetPath;
|
||||||
File.Copy(
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) {
|
||||||
"/Applications/MuJoCo.app/Contents/Frameworks" +
|
if (AssetDatabase.LoadMainAssetAtPath(mujocoPath + "/mujoco.dylib") == null) {
|
||||||
"/mujoco.framework/Versions/Current/libmujoco.2.2.1.dylib",
|
File.Copy(
|
||||||
mujocoPath + "/mujoco.dylib");
|
"/Applications/MuJoCo.app/Contents/Frameworks" +
|
||||||
AssetDatabase.Refresh();
|
"/mujoco.framework/Versions/Current/libmujoco.2.2.1.dylib",
|
||||||
}
|
mujocoPath + "/mujoco.dylib");
|
||||||
} else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) {
|
AssetDatabase.Refresh();
|
||||||
if (AssetDatabase.LoadMainAssetAtPath(mujocoPath + "/libmujoco.so") == null) {
|
}
|
||||||
File.Copy(
|
} else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) {
|
||||||
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) +
|
if (AssetDatabase.LoadMainAssetAtPath(mujocoPath + "/libmujoco.so") == null) {
|
||||||
"/.mujoco/mujoco-2.2.1/lib/libmujoco.so.2.2.1",
|
File.Copy(
|
||||||
mujocoPath + "/libmujoco.so");
|
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) +
|
||||||
AssetDatabase.Refresh();
|
"/.mujoco/mujoco-2.2.1/lib/libmujoco.so.2.2.1",
|
||||||
}
|
mujocoPath + "/libmujoco.so");
|
||||||
} else {
|
AssetDatabase.Refresh();
|
||||||
if (AssetDatabase.LoadMainAssetAtPath(mujocoPath + "/mujoco.dll") == null) {
|
}
|
||||||
File.Copy(
|
} else {
|
||||||
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) +
|
if (AssetDatabase.LoadMainAssetAtPath(mujocoPath + "/mujoco.dll") == null) {
|
||||||
"\\MuJoCo\\bin\\mujoco.dll",
|
File.Copy(
|
||||||
mujocoPath + "\\mujoco.dll");
|
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) +
|
||||||
AssetDatabase.Refresh();
|
"\\MuJoCo\\bin\\mujoco.dll",
|
||||||
|
mujocoPath + "\\mujoco.dll");
|
||||||
|
AssetDatabase.Refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -12,5 +12,6 @@
|
|||||||
"changelogUrl": "https://mujoco.readthedocs.io/en/latest/changelog.html",
|
"changelogUrl": "https://mujoco.readthedocs.io/en/latest/changelog.html",
|
||||||
"documentationUrl": "https://mujoco.readthedocs.io/en/latest/unity.html",
|
"documentationUrl": "https://mujoco.readthedocs.io/en/latest/unity.html",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"licensesUrl": "https://github.com/deepmind/mujoco/blob/main/LICENSE"
|
"licensesUrl": "https://github.com/deepmind/mujoco/blob/main/LICENSE",
|
||||||
|
"hideInEditor": false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user