Skip to content

Commit c952f0a

Browse files
committed
[OMCPath] add definition of is_absolute(); consider Windows systems
1 parent 794d871 commit c952f0a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

OMPython/OMCSession.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,15 @@ def is_dir(self, *, follow_symlinks=True) -> bool:
307307
"""
308308
return self._session.sendExpression(f'directoryExists("{self.as_posix()}")')
309309

310+
def is_absolute(self):
311+
"""
312+
Check if the path is an absolute path considering the possibility that we are running locally on Windows. This
313+
case needs special handling as the definition of is_absolute() differs.
314+
"""
315+
if isinstance(self._session, OMCProcessLocal) and platform.system() == 'Windows':
316+
return pathlib.PureWindowsPath(self.as_posix()).is_absolute()
317+
return super().is_absolute()
318+
310319
def read_text(self, encoding=None, errors=None, newline=None) -> str:
311320
"""
312321
Read the content of the file represented by this path as text.

0 commit comments

Comments
 (0)