mrmlnc / fast-glob

:rocket: It's a very fast and efficient glob library for Node.js
MIT License
2.56k stars 112 forks source link

Strange behavior at Windows root dir like D:/ #375

Open crystalfp opened 1 year ago

crystalfp commented 1 year ago

Environment

Actual behavior

On Windows, listing the root directory of a disk like D:/* shows the content of the current working directory as it was under D:/ (see below the content of dirBad). I had to apply the workaround in dirGood to obtain the real content.

Expected behavior

List the content of the root directory.

Steps to reproduce

  1. Externally look at the content of current working directory (e.g., D:/project/node_modules ...)
  2. Run the code below
  3. Look at dirGood. It contains the true content of the root directory (D:/./$RECYCLE.BIN)
  4. Look at dirBad. It contains the current directory content as if D:/ were equivalent to ./

Code sample

const fg = require("fast-glob")
const dirBad = fg.sync("D:/*", {onlyDirectories: true})
const dirGood = fg.sync("D:/./*", {onlyDirectories: true})
mrmlnc commented 1 year ago

https://github.com/gulpjs/glob-parent/issues/63

supanpanCn commented 1 year ago

I had the same problem