VSCode Copy Relative Path with posix forward slashes

Viewed 3498

VSC newbie here.

I'm trying to right-click on my projects' files and selecting Copy Relative Path, the thing is I get the path like this: node_modules\bootstrap\dist\css\bootstrap.min.css

when what I actually need is this: node_modules/bootstrap/dist/css/bootstrap.min.css

Where can I change these settings to avoid the manual editing, It's really time consuming.

Thanks for your help.

2 Answers

As of vscode 1.59 (the next Stable build as of now) you will be able to enable using the / separator even on Windows for the Copy Relative Path command.

Explorer: Copy Relative Path Separator set to /.

explorer.copyRelativePathSeparator

  • auto (default): Uses operating system specific path separation character
  • /: Use slash as path separation character
  • \\: Use backslash as path separation character

See https://github.com/microsoft/vscode/issues/56279

I think it because you used windows in which the os uses \ instead of / in the path. I'd suggest to use raw strings in the path like for example r'node_modules\bootstrap\dist\css\bootstrap.min.css'. Another way to change all the \ to / is by using the replace function in vscode!

Related