kwcoco.util.util_windows module¶
- kwcoco.util.util_windows.fix_msys_path(path)[source]¶
Windows is so special. When using msys bash if you pass a path on the CLI it resolves /c to C:/, but if you have you path as part of a config string, it doesnt know how to do that, and at that point Python doesn’t handle the msys style /c paths. This is a hack detects and fixes this in this location.
Example
>>> print(fix_msys_path('/c/Users/foobar')) C:/Users/foobar >>> print(fix_msys_path(r'\c\Users\foobar')) C:/Users\foobar >>> print(fix_msys_path(r'\d\Users\foobar')) D:/Users\foobar >>> print(fix_msys_path(r'\z')) Z:/ >>> import pathlib >>> assert fix_msys_path(pathlib.Path(r'\z')) == pathlib.Path('Z:/')