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

Method host_to_virtual_path

qiling/os/path.py:268–282  ·  view source on GitHub ↗

Convert a host path to its corresponding virtual path relative to rootfs. Args: hostpath : host path Returns: the corresponding virtual path Raises: `ValueError` in case the host path does not map to a rootfs location

(self, hostpath: str)

Source from the content-addressed store, hash-verified

266 return True
267
268 def host_to_virtual_path(self, hostpath: str) -> str:
269 """Convert a host path to its corresponding virtual path relative to rootfs.
270
271 Args:
272 hostpath : host path
273
274 Returns: the corresponding virtual path
275
276 Raises: `ValueError` in case the host path does not map to a rootfs location
277 """
278
279 resolved = Path(hostpath).resolve(strict=False)
280 virtpath = self._cwd_anchor / resolved.relative_to(self._rootfs_path)
281
282 return str(virtpath)
283
284 def is_virtual_abspath(self, virtpath: str) -> bool:
285 """Determine whether a given virtual path is absolute.

Callers 7

handle_qMethod · 0.80
__GetModuleFileNameFunction · 0.80
ql_syscall_getsocknameFunction · 0.80
ql_syscall_getpeernameFunction · 0.80
ql_syscall_acceptFunction · 0.80
virtual_abspath_atFunction · 0.80
__do_readlinkFunction · 0.80

Calls 1

resolveMethod · 0.45

Tested by

no test coverage detected