Reputation: 1197
Using VScode CLI (code) with relative path works fine with cygwin:
code ../source
but using absolute path it gives me something that starts with C://cygdrive/c/...
:
code ~/source
gives me C://cygdrive/c/Users/user/source
.
This path does not exist, so I create a new file.
How can I make cygwin work with absolute paths?
VScode in PATH looks like this: /cygdrive/c/Users/user/AppData/Local/Programs/Microsoft VS Code/bin:
Upvotes: 0
Views: 1304
Reputation: 1197
The problem seems to be that VScode (windows side) gets C:\cygdrive\c\Users\user\source
and tries to resolve it. This leads to file not found so we create a new one in that path.
I solved it on the windows side by creating a symbolic link between C:\cygdrive\c\
with C:\
.
C
named cygdrive
.mklink /D "C:\cygdrive\c\" "C:\"
.and VScode runs as expected.
Upvotes: 1
Reputation: 23366
VScode on Windows probably does not expect nor properly interpret POSIX-style paths. /cygdrive/c/...
is an absolute path from the Cygwin perspective (by default Cygwin mounts your Windows drive letters under /cygwin/
).
But to VScode (or other native Windows applications) this does not look like an absolute path, so it will prepend C:\something\...
to it to make it absolute.
As with most path issues related to using native Windows applications on Cygwin, you should use the cygpath
utility to convert your path to one VScode can understand. E.g.
$ code "$(cygpath -w -a ~/source)"
See Using Cygwin effectively with Windows.
Upvotes: 1