how-to-npm icon indicating copy to clipboard operation
how-to-npm copied to clipboard

Incorrectly reports wrong folder on windows due to case sensitivity

Open schellingerhout opened this issue 7 years ago • 1 comments

On Windows cd with a fully qualified name will list the Current Working Directory with the correct case for the folders (regardless of how the case was typed). However, the drive letter receives the case as typed.

This may cause a false failure of a mismatched path compared to the cwd file checked in the lesson

Uh oh! It looks like you are in the wrong folder.

To reproduce the issue:

  • Complete lessons up to the point where C:\Users\_UserName_\.config\how-to-npm\cwd file is created
  • If you are already in the working folder then cd to any other folder.
  • cd back to the working folder (the one containing .npmrc) using a fully qualified path, but this time change the case of the drive letter (the case of the rest of the path does not matter)
  • run how-to-npm verify

Folders cannot be checked case-insensitive on other platforms, but the issue here seems to be limited to just the driver letter on Windows. Perhaps checking for a Windows style drive letter and handling in a special case?

schellingerhout avatar Mar 04 '17 19:03 schellingerhout

To help with this problem I created a package same-path, and published thanks to this very tutorial.

More testing required, but initial manual tests work fine on Ubuntu and Windows, plus it resolves relative paths.

schellingerhout avatar Mar 06 '17 02:03 schellingerhout