From ed2f34baa01939edd8a4532af2d112085a733594 Mon Sep 17 00:00:00 2001 From: Haroon Qureshi Date: Wed, 11 Mar 2026 06:17:35 -0700 Subject: [PATCH] Fix logic for looking up root model within an archive. PiperOrigin-RevId: 881976329 Change-Id: I7771b84ff0aed83d55ee830deb2f92357355eb88 --- src/experimental/mjz/mjz_decoder.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/experimental/mjz/mjz_decoder.cc b/src/experimental/mjz/mjz_decoder.cc index 59ec7656..409607e7 100644 --- a/src/experimental/mjz/mjz_decoder.cc +++ b/src/experimental/mjz/mjz_decoder.cc @@ -74,11 +74,11 @@ class ZipArchiveProvider : public mjpResourceProvider { // Look for the root XML model in the archive. First look for an XML file // with the same name as the archive itself. Failing that, look for an XML - // file with the same name including the parent directory. + // file within a subdirectory with the same name as the archive. const std::filesystem::path path(name_); root_model_ = (path / path.stem()).string() + ".xml"; if (!Contains(root_model_)) { - root_model_ = (path / path.parent_path() / path.stem()).string() + ".xml"; + root_model_ = (path / path.stem() / path.stem()).string() + ".xml"; if (!Contains(root_model_)) { SetError(error, error_sz, "Zip error: no root XML file found."); return;