File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -138,20 +138,6 @@ export async function readdir(path: string): Promise<string[]> {
138138 return handleDirectoryChildren ( await promisify ( fs . readdir ) ( path ) ) ;
139139}
140140
141- export async function readdirWithFileTypes ( path : string ) : Promise < fs . Dirent [ ] > {
142- const children = await promisify ( fs . readdir ) ( path , { withFileTypes : true } ) ;
143-
144- // Mac: uses NFD unicode form on disk, but we want NFC
145- // See also https://github.com/nodejs/node/issues/2165
146- if ( platform . isMacintosh ) {
147- for ( const child of children ) {
148- child . name = normalizeNFC ( child . name ) ;
149- }
150- }
151-
152- return children ;
153- }
154-
155141export function readdirSync ( path : string ) : string [ ] {
156142 return handleDirectoryChildren ( fs . readdirSync ( path ) ) ;
157143}
@@ -479,12 +465,12 @@ function ensureWriteOptions(options?: IWriteFileOptions): IEnsuredWriteFileOptio
479465}
480466
481467export async function readDirsInDir ( dirPath : string ) : Promise < string [ ] > {
482- const children = await readdirWithFileTypes ( dirPath ) ;
468+ const children = await readdir ( dirPath ) ;
483469 const directories : string [ ] = [ ] ;
484470
485471 for ( const child of children ) {
486- if ( child . isDirectory ( ) ) {
487- directories . push ( child . name ) ;
472+ if ( await dirExists ( join ( dirPath , child ) ) ) {
473+ directories . push ( child ) ;
488474 }
489475 }
490476
Original file line number Diff line number Diff line change @@ -386,24 +386,6 @@ suite('PFS', () => {
386386 }
387387 } ) ;
388388
389- test ( 'readdirWithFileTypes' , async ( ) => {
390- if ( canNormalize && typeof process . versions [ 'electron' ] !== 'undefined' /* needs electron */ ) {
391- const id = uuid . generateUuid ( ) ;
392- const parentDir = path . join ( os . tmpdir ( ) , 'vsctests' , id ) ;
393- const newDir = path . join ( parentDir , 'pfs' , id , 'öäü' ) ;
394-
395- await pfs . mkdirp ( newDir , 493 ) ;
396-
397- assert . ok ( fs . existsSync ( newDir ) ) ;
398-
399- const children = await pfs . readdirWithFileTypes ( path . join ( parentDir , 'pfs' , id ) ) ;
400- assert . equal ( children . some ( n => n . name === 'öäü' ) , true ) ; // Mac always converts to NFD, so
401- assert . equal ( children . some ( n => n . isDirectory ( ) ) , true ) ;
402-
403- await pfs . rimraf ( parentDir ) ;
404- }
405- } ) ;
406-
407389 test ( 'writeFile (string)' , async ( ) => {
408390 const smallData = 'Hello World' ;
409391 const bigData = ( new Array ( 100 * 1024 ) ) . join ( 'Large String\n' ) ;
You can’t perform that action at this time.
0 commit comments