Skip to content

Commit 61b6b58

Browse files
committed
[OMCPath] add definition of is_absolute(); consider Windows systems
1 parent 36eb1e4 commit 61b6b58

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
@@ -304,6 +304,15 @@ def is_dir(self, *, follow_symlinks=True) -> bool:
304304
"""
305305
return self._session.sendExpression(f'directoryExists("{self.as_posix()}")')
306306

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

0 commit comments

Comments
 (0)