Closed nkmathew closed 6 years ago
Hi, that's right. I suppose I should use &shellslash
value, although I am not entirely sure how wrong slashes behave on windows.
Or just replace both slashes with a regex, should work for most cases. It could probably fail for paths with spaces e.g. '/first/second/some\ folder' but if you're seriously doing that then you deserve to be bitten :)
Both expand() and glob() will make the "right" slash from a mixed filename and escaped spaces and like dhruvasagar wrote, the shellslash option tells what kind of slash expand() and glob() is using.
:set nossl
:echo expand('c:\temp/new\ folder/sub')
c:\temp\new folder\sub
:set ssl
:echo expand('c:\temp/new\ folder/sub')
c:/temp/new folder/sub
P.S. getcwd() also works like this.
Closing this issue for now, reopen if you face any issues.
It's assuming that paths in Windows will always have backslashes: