Fix logic for looking up root model within an archive.
PiperOrigin-RevId: 881976329 Change-Id: I7771b84ff0aed83d55ee830deb2f92357355eb88
This commit is contained in:
committed by
Copybara-Service
parent
df02fe4bc0
commit
ed2f34baa0
@@ -74,11 +74,11 @@ class ZipArchiveProvider : public mjpResourceProvider {
|
|||||||
|
|
||||||
// Look for the root XML model in the archive. First look for an XML file
|
// 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
|
// 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_);
|
const std::filesystem::path path(name_);
|
||||||
root_model_ = (path / path.stem()).string() + ".xml";
|
root_model_ = (path / path.stem()).string() + ".xml";
|
||||||
if (!Contains(root_model_)) {
|
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_)) {
|
if (!Contains(root_model_)) {
|
||||||
SetError(error, error_sz, "Zip error: no root XML file found.");
|
SetError(error, error_sz, "Zip error: no root XML file found.");
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user