Skip to content

readdirSync of drive letter lists items of cwd #9378

@cosmo0

Description

@cosmo0
  • Version: v6.9.1
  • Platform: Windows 8.1 x64

ReaddirSync behavior depends on the current working directory (cwd/pwd) if we pass a drive letter with or without a trailing "".

It's very easy to reproduce. Here, I am on "d:" drive, and I have a "d:\Temp" folder, containing "A" and "B" sub-folders.

D:\Temp>  gci | % { $_.Name }
A
B

D:\Temp> node
> var fs = require('fs');
undefined
> fs.readdirSync('d:')
[ 'A', 'B' ]
> fs.readdirSync('d:\\')
[ '$RECYCLE.BIN',
  'Cache',
  'DEV',
  'Installers',
  'log',
  'pagefile.sys',
  'System Volume Information',
  'Temp',
  'VM' ]
> .exit
D:\Temp>

It's a very suprising behavior, and more importantly, it's not documented if expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.docIssues and PRs related to the documentations.fsIssues and PRs related to the fs subsystem / file system.good first issueIssues that are suitable for first-time contributors.windowsIssues and PRs related to the Windows platform.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions