Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support search schemaPath from OpenModelica super project #1267

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/OMSimulatorLib/XercesValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,22 @@ oms_status_enu_t oms::XercesValidator::validateSSP(const char *ssd, const std::s
// the shared libraries are put in "install/lib/x86_64-linux-gnu/", so to find the schema location we have to move two directories back
if (!filesystem::exists(schemaSSDPath))
{
// schema path from OMSimulator standalone builds
schemaSSDPath = schemaRootPath / "../../share/OMSimulator/schema/ssp/SystemStructureDescription.xsd";
schemaSSVPath = schemaRootPath / "../../share/OMSimulator/schema/ssp/SystemStructureParameterValues.xsd";
schemaSSMPath = schemaRootPath / "../../share/OMSimulator/schema/ssp/SystemStructureParameterMapping.xsd";
schemaSSCPath = schemaRootPath / "../../share/OMSimulator/schema/ssp/SystemStructureCommon.xsd";
}

// search schema path from top superproject OpenModelica location, shared libs are put in "build/lib/x86_64-linux-gnu/omc/libOMSimulator.so"
if (!filesystem::exists(schemaSSDPath))
{
schemaSSDPath = schemaRootPath / "../../../share/OMSimulator/schema/ssp/SystemStructureDescription.xsd";
schemaSSVPath = schemaRootPath / "../../../share/OMSimulator/schema/ssp/SystemStructureParameterValues.xsd";
schemaSSMPath = schemaRootPath / "../../../share/OMSimulator/schema/ssp/SystemStructureParameterMapping.xsd";
schemaSSCPath = schemaRootPath / "../../../share/OMSimulator/schema/ssp/SystemStructureCommon.xsd";
}

XercesDOMParser domParser;

// load the schema
Expand Down Expand Up @@ -252,9 +262,16 @@ oms_status_enu_t oms::XercesValidator::validateFMU(const char *modeldescription,
// the shared libraries are put in "install/lib/x86_64-linux-gnu/", so to find the schema location we have to move two directories back
if (!filesystem::exists(schemaFmiModeldescriptionPath))
{
// schema path from standalone OMSimulator build
schemaFmiModeldescriptionPath = schemaRootPath / "../../share/OMSimulator/schema/fmi2/fmi2ModelDescription.xsd";
}

// schema path from top superproject OpenModelica location, shared libs are put in "build/lib/x86_64-linux-gnu/omc/libOMSimulator.so"
if (!filesystem::exists(schemaFmiModeldescriptionPath))
{
schemaFmiModeldescriptionPath = schemaRootPath / "../../../share/OMSimulator/schema/fmi2/fmi2ModelDescription.xsd";
}

XercesDOMParser domParser;

// load the schema
Expand Down