File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed
Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change 11import path from 'path'
22import { readdir } from 'node:fs/promises' ;
3+ import { existsSync } from 'node:fs' ;
34import { getDotnetLifeCycles , type DotnetLifeCycle } from './endoflife' ;
45
56export const getDownloadDirectory = ( ) : string => {
@@ -105,19 +106,19 @@ export const getInstalledRuntimeVersions = async (withLifeCycle: boolean = true)
105106}
106107
107108const getDirectories = async ( source : string ) : Promise < Directory [ ] > =>
108- {
109- if ( ! ( await ( Bun . file ( source ) . exists ( ) ) ) ) {
110- return [ ]
111- }
112-
113- return ( await readdir ( source , { withFileTypes : true } ) )
114- . filter ( dirent => dirent . isDirectory ( ) )
115- . map ( dirent => ( {
116- name : dirent . name ,
117- path : path . resolve ( source , dirent . name )
118- } ) as Directory ) ;
109+ {
110+ if ( ! ( await existsSync ( source ) ) ) {
111+ return [ ]
119112 }
120113
114+ return ( await readdir ( source , { withFileTypes : true } ) )
115+ . filter ( dirent => dirent . isDirectory ( ) )
116+ . map ( dirent => ( {
117+ name : dirent . name ,
118+ path : path . resolve ( source , dirent . name )
119+ } ) as Directory ) ;
120+ }
121+
121122type Directory = {
122123 name : string
123124 path : string
You can’t perform that action at this time.
0 commit comments