35

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.

Mark
  • 143,421
  • 24
  • 428
  • 436
KrOo Pine
  • 451
  • 4
  • 5

2 Answers2

48

As of vscode 1.59 you can 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

enter image description here


For the same ability to designate the path separator for the copy full path (tab context menu: Copy Path) command, there is an issue with a PR awaiting resolution: Allow to configure the which slash is used when copying a path.

vsync
  • 118,978
  • 58
  • 307
  • 400
Mark
  • 143,421
  • 24
  • 428
  • 436
2

I think it's because you used Windows, which uses \ instead of / in paths. I suggest using raw strings in the path. 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!

ABabin
  • 2,724
  • 24
  • 30
Owen Valentinus
  • 611
  • 4
  • 12