Convert a path from Cygwin-native to Windows-native. Uses the cygpath utility (part of the Base install) to do the actual conversion. Falls back to returning the original path if this fails. Handles the default ``/cygdrive`` mount prefix as well as the ``/proc/cygdrive`` porta
(path: str)
| 384 | ######################### |
| 385 | |
| 386 | def cyg2win32(path: str) -> str: |
| 387 | """Convert a path from Cygwin-native to Windows-native. |
| 388 | |
| 389 | Uses the cygpath utility (part of the Base install) to do the |
| 390 | actual conversion. Falls back to returning the original path if |
| 391 | this fails. |
| 392 | |
| 393 | Handles the default ``/cygdrive`` mount prefix as well as the |
| 394 | ``/proc/cygdrive`` portable prefix, custom cygdrive prefixes such |
| 395 | as ``/`` or ``/mnt``, and absolute paths such as ``/usr/src/`` or |
| 396 | ``/home/username`` |
| 397 | |
| 398 | Parameters |
| 399 | ---------- |
| 400 | path : str |
| 401 | The path to convert |
| 402 | |
| 403 | Returns |
| 404 | ------- |
| 405 | converted_path : str |
| 406 | The converted path |
| 407 | |
| 408 | Notes |
| 409 | ----- |
| 410 | Documentation for cygpath utility: |
| 411 | https://cygwin.com/cygwin-ug-net/cygpath.html |
| 412 | Documentation for the C function it wraps: |
| 413 | https://cygwin.com/cygwin-api/func-cygwin-conv-path.html |
| 414 | |
| 415 | """ |
| 416 | if sys.platform != "cygwin": |
| 417 | return path |
| 418 | return subprocess.check_output( |
| 419 | ["/usr/bin/cygpath", "--windows", path], text=True |
| 420 | ) |
| 421 | |
| 422 | |
| 423 | def mingw32(): |
no test coverage detected