Skip to content

Commit 2c6adaa

Browse files
committed
[ModelicaSystem] replace pathlib by OMCPath
1 parent 5cba56b commit 2c6adaa

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
@@ -1587,7 +1587,7 @@ def convertMo2Fmu(
15871587
fmuType: str = "me_cs",
15881588
fileNamePrefix: Optional[str] = None,
15891589
includeResources: bool = True,
1590-
) -> pathlib.Path:
1590+
) -> OMCPath:
15911591
"""Translate the model into a Functional Mockup Unit.
15921592
15931593
Args:
@@ -1625,7 +1625,7 @@ def convertMo2Fmu(
16251625
def convertFmu2Mo(
16261626
self,
16271627
fmu: os.PathLike,
1628-
) -> pathlib.Path:
1628+
) -> OMCPath:
16291629
"""
16301630
In order to load FMU, at first it needs to be translated into Modelica model. This method is used to generate
16311631
Modelica model from the given FMU. It generates "fmuName_me_FMU.mo".
@@ -1634,7 +1634,10 @@ def convertFmu2Mo(
16341634
>>> convertFmu2Mo("c:/BouncingBall.Fmu")
16351635
"""
16361636

1637-
fmu_path = pathlib.Path(fmu)
1637+
fmu_path = self._getconn.omcpath(fmu)
1638+
1639+
if not fmu_path.is_file():
1640+
raise ModelicaSystemError(f"Missing FMU file: {fmu_path.as_posix()}")
16381641

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

0 commit comments

Comments
 (0)