LibraryManager icon indicating copy to clipboard operation
LibraryManager copied to clipboard

Issue with directory separator on linux

Open tbolon opened this issue 7 years ago • 3 comments

Functional impact

When restoring libraries on linux, the \ character is not used as a directory separator.

Minimal repro steps

  1. Create a libman.json with a library with a destination containing a subfolder (the default suggested value can be used)
  2. 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.

tbolon avatar Aug 31 '18 13:08 tbolon

Thanks for raising this issue. We will look into it.

justcla avatar Sep 14 '18 17:09 justcla

Options:

  1. 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?
  2. Have the LibMan restore operation recognise the double backslash and treat it as forward slash (directory separator).

justcla avatar Sep 14 '18 17:09 justcla

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.

tbolon avatar Sep 14 '18 18:09 tbolon