@@ -373,15 +373,20 @@ def resolve(self, strict: bool = False):
373373 raise OMCSessionException (f"Path { self .as_posix ()} does not exist!" )
374374
375375 if self .is_file ():
376- omcpath = self ._omc_resolve (self .parent .as_posix ()) / self .name
376+ pathstr_resolved = self ._omc_resolve (self .parent .as_posix ())
377+ omcpath_resolved = self ._session .omcpath (pathstr_resolved ) / self .name
377378 elif self .is_dir ():
378- omcpath = self ._omc_resolve (self .as_posix ())
379+ pathstr_resolved = self ._omc_resolve (self .as_posix ())
380+ omcpath_resolved = self ._session .omcpath (pathstr_resolved )
379381 else :
380382 raise OMCSessionException (f"Path { self .as_posix ()} is neither a file nor a directory!" )
381383
382- return omcpath
384+ if not omcpath_resolved .is_file () and not omcpath_resolved .is_dir ():
385+ raise OMCSessionException (f"OMCPath resolve failed for { self .as_posix ()} - path does not exist!" )
383386
384- def _omc_resolve (self , pathstr : str ):
387+ return omcpath_resolved
388+
389+ def _omc_resolve (self , pathstr : str ) -> str :
385390 """
386391 Internal function to resolve the path of the OMCPath object using OMC functions *WITHOUT* changing the cwd
387392 within OMC.
@@ -395,15 +400,10 @@ def _omc_resolve(self, pathstr: str):
395400 result_parts = result .split ('\n ' )
396401 pathstr_resolved = result_parts [1 ]
397402 pathstr_resolved = pathstr_resolved [1 :- 1 ] # remove quotes
398-
399- omcpath_resolved = self ._session .omcpath (pathstr_resolved )
400403 except OMCSessionException as ex :
401404 raise OMCSessionException (f"OMCPath resolve failed for { pathstr } !" ) from ex
402405
403- if not omcpath_resolved .is_file () and not omcpath_resolved .is_dir ():
404- raise OMCSessionException (f"OMCPath resolve failed for { pathstr } - path does not exist!" )
405-
406- return omcpath_resolved
406+ return pathstr_resolved
407407
408408 def absolute (self ):
409409 """
0 commit comments