Display error message when requested file does not exist.
PiperOrigin-RevId: 859583121 Change-Id: Id9969e486499a70769e325161c3cd2c204006d9a
This commit is contained in:
committed by
Copybara-Service
parent
98593259e7
commit
bab468703c
@@ -180,6 +180,11 @@ void App::LoadModelFromFile(const std::string& filepath) {
|
||||
const std::string resolved_file =
|
||||
platform::ResolveFile(filepath, search_paths_);
|
||||
|
||||
if (resolved_file.empty()) {
|
||||
SetLoadError("File not found: " + filepath);
|
||||
return;
|
||||
}
|
||||
|
||||
char err[1000] = "";
|
||||
if (resolved_file.ends_with(".mjb")) {
|
||||
model = mj_loadModel(resolved_file.c_str(), &vfs);
|
||||
|
||||
Reference in New Issue
Block a user