MCPcopy Create free account
hub / github.com/qilingframework/qiling / __virtual_abspath

Method __virtual_abspath

qiling/os/path.py:91–114  ·  view source on GitHub ↗

Get the absolute virtual path representation of a virtual path. This method does not follow symbolic links or parent directory references. Args: virtpath: virtual path to resolve, either relative or absolute Returns: An absolute virtual path

(self, virtpath: Union[str, AnyPurePath])

Source from the content-addressed store, hash-verified

89 self._cwd_vpath = cwd_vpath
90
91 def __virtual_abspath(self, virtpath: Union[str, AnyPurePath]) -> AnyPurePath:
92 """Get the absolute virtual path representation of a virtual path.
93 This method does not follow symbolic links or parent directory references.
94
95 Args:
96 virtpath: virtual path to resolve, either relative or absolute
97
98 Returns: An absolute virtual path
99 """
100
101 vpath = self.PureVirtualPath(virtpath)
102
103 if vpath.is_absolute():
104 return vpath
105
106 # rebase on top the current working directory. in case vpath is an absolute
107 # path, cwd will be discarded
108 absvpath = self._cwd_vpath / vpath
109
110 # referencing root's parent directory should circle back to root.
111 # remove any leading parent dir references absvpath might have
112 absvpath = QlOsPath.__strip_parent_refs(absvpath)
113
114 return self._cwd_anchor / absvpath
115
116 def __resolved_vsymlink(self, basepath: Path, name: str):
117 """Attempt to resolve a virtual symbolic link.

Callers 3

__virtual_resolveMethod · 0.95
virtual_abspathMethod · 0.95

Calls 1

__strip_parent_refsMethod · 0.80

Tested by

no test coverage detected