Skip to content

Commit 8f3f13f

Browse files
committed
[ModelicaSystem] replace pathlib by OMCPath
1 parent c1095de commit 8f3f13f

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

OMPython/ModelicaSystem.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,7 +1572,7 @@ def convertMo2Fmu(
15721572
fmuType: str = "me_cs",
15731573
fileNamePrefix: Optional[str] = None,
15741574
includeResources: bool = True,
1575-
) -> pathlib.Path:
1575+
) -> OMCPath:
15761576
"""Translate the model into a Functional Mockup Unit.
15771577
15781578
Args:
@@ -1610,7 +1610,7 @@ def convertMo2Fmu(
16101610
def convertFmu2Mo(
16111611
self,
16121612
fmu: os.PathLike,
1613-
) -> pathlib.Path:
1613+
) -> OMCPath:
16141614
"""
16151615
In order to load FMU, at first it needs to be translated into Modelica model. This method is used to generate
16161616
Modelica model from the given FMU. It generates "fmuName_me_FMU.mo".
@@ -1619,7 +1619,10 @@ def convertFmu2Mo(
16191619
>>> convertFmu2Mo("c:/BouncingBall.Fmu")
16201620
"""
16211621

1622-
fmu_path = pathlib.Path(fmu)
1622+
fmu_path = self._getconn.omcpath(fmu)
1623+
1624+
if not fmu_path.is_file():
1625+
raise ModelicaSystemError(f"Missing FMU file: {fmu_path.as_posix()}")
16231626

16241627
filename = self._requestApi(apiName='importFMU', entity=fmu_path.as_posix())
16251628
filepath = self._work_dir / filename

0 commit comments

Comments
 (0)