Skip to content

Commit efd7392

Browse files
committed
[OMCPath] differentiate between Windows and Posix for OMCPathCompatibility
1 parent f44f49c commit efd7392

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

OMPython/OMCSession.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,12 +420,20 @@ def size(self) -> int:
420420
stacklevel=1,
421421
)
422422

423-
class OMCPathCompatibility(pathlib.Path):
423+
if os.name == 'nt':
424+
class OMCPathCompatibility(pathlib.WindowsPath):
424425

425-
def size(self) -> int:
426-
return self.stat().st_size
426+
def size(self) -> int:
427+
return self.stat().st_size
427428

428-
OMCPath = OMCPathCompatibility # noqa: F811
429+
OMCPath = OMCPathCompatibility # noqa: F811
430+
else:
431+
class OMCPathCompatibility(pathlib.PosixPath):
432+
433+
def size(self) -> int:
434+
return self.stat().st_size
435+
436+
OMCPath = OMCPathCompatibility # noqa: F811
429437

430438
else:
431439
OMCPath = OMCPathReal

0 commit comments

Comments
 (0)