Skip to content

Commit 7695fad

Browse files
committed
[ModelicaSystem] replace pathlib by OMCPath
1 parent 81ae348 commit 7695fad

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
@@ -1603,7 +1603,7 @@ def convertMo2Fmu(
16031603
fmuType: str = "me_cs",
16041604
fileNamePrefix: Optional[str] = None,
16051605
includeResources: bool = True,
1606-
) -> pathlib.Path:
1606+
) -> OMCPath:
16071607
"""Translate the model into a Functional Mockup Unit.
16081608
16091609
Args:
@@ -1641,7 +1641,7 @@ def convertMo2Fmu(
16411641
def convertFmu2Mo(
16421642
self,
16431643
fmu: os.PathLike,
1644-
) -> pathlib.Path:
1644+
) -> OMCPath:
16451645
"""
16461646
In order to load FMU, at first it needs to be translated into Modelica model. This method is used to generate
16471647
Modelica model from the given FMU. It generates "fmuName_me_FMU.mo".
@@ -1650,7 +1650,10 @@ def convertFmu2Mo(
16501650
>>> convertFmu2Mo("c:/BouncingBall.Fmu")
16511651
"""
16521652

1653-
fmu_path = pathlib.Path(fmu)
1653+
fmu_path = self._getconn.omcpath(fmu)
1654+
1655+
if not fmu_path.is_file():
1656+
raise ModelicaSystemError(f"Missing FMU file: {fmu_path.as_posix()}")
16541657

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

0 commit comments

Comments
 (0)