wsl-path-converter icon indicating copy to clipboard operation
wsl-path-converter copied to clipboard

Documentation example escaping

Open JCCChris opened this issue 5 years ago • 1 comments

If I copy and paste the examples, you give in the readme, I just get a ">" prompt since the \ is not escaped.

JCCChris avatar Mar 06 '20 16:03 JCCChris

Hi, I am observing this issue in a build from the master branch. As per https://github.com/lamyj/wsl-path-converter/issues/3#issuecomment-597183972, this issue should have been fixed, but it still exists. I am using WSL2 with python 3.8.3.

$ wpc -u C:\users
Traceback (most recent call last):
  File "/home/user/anaconda3/bin/wpc", line 8, in <module>
    sys.exit(main())
  File "/home/user/anaconda3/lib/python3.8/site-packages/wsl_path_converter/main.py", line 47, in main
    print(converter(arguments.path))
  File "/home/user/anaconda3/lib/python3.8/site-packages/wsl_path_converter/__init__.py", line 28, in convert_u
    windows_root = find_root(linux_roots, windows_path, "\\")
  File "/home/user/anaconda3/lib/python3.8/site-packages/wsl_path_converter/__init__.py", line 101, in find_root
    raise Exception("No root found for {}".format(path))
Exception: No root found for C:users

From the last line, its seen that \ is removed.

$ wpc -u C:\\users
/mnt/c/users

$ wpc -u "C:\users"
/mnt/c/users

Escaping the \ or enclosing the path with " makes it work.

Maybe we should update the docs?

pankajchetry1168 avatar Jan 15 '21 19:01 pankajchetry1168