Issue with directory separator on linux
Functional impact
When restoring libraries on linux, the \ character is not used as a directory separator.
Minimal repro steps
- Create a libman.json with a library with a destination containing a subfolder (the default suggested value can be used)
- Use libman on a linux environment (bash on windows in my case) to restore the library
Expected result
The directory separator should be respected and converted to /, eg: lib\\jquery => lib/jquery
Actual result
A single directory is created with a \ character in its name.
Further technical details
As a workaround, using / in the libman.json as a directory separator works on both linux and windows.
Thanks for raising this issue. We will look into it.
Options:
- VS tooling and CLI to both insert forward slash for directory separators. Problem: What if users manually enter a double backslash in the libman.json file?
- Have the LibMan restore operation recognise the double backslash and treat it as forward slash (directory separator).
I found this anwser on SO helpful today while trying to handle directory separator in a .net core app. You should have a look.
The conclusion is that windows handle both / and \ as directory separators, while linux doesn't. So always using '/' separator in config will work well in both environments.
Also note that GetFullPath convert '/' to '' in windows and can be used at runtime when absolute path is resolved.