File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ export class RLocalHelpPreviewer {
103103
104104 private readonly dummyPackageName : string ;
105105
106- constructor ( options : RHelpPreviewerOptions , packageDir : string , unnamedId : number = 1 ) {
106+ constructor ( options : RHelpPreviewerOptions , packageDir : string , unnamedId : number = 1 ) {
107107 this . packageDir = packageDir ;
108108 this . descriptionPath = path . join ( this . packageDir , 'DESCRIPTION' ) ;
109109 this . manDir = path . join ( this . packageDir , 'man' ) ;
Original file line number Diff line number Diff line change @@ -621,18 +621,18 @@ export function readdirSyncSafe(
621621
622622export function statSyncSafe ( path : fs . PathLike ) : fs . Stats | undefined {
623623 try {
624- return fs . statSync ( path ) ;
624+ return fs . statSync ( path , { throwIfNoEntry : false } ) ;
625625 } catch ( e ) {
626-
626+ return undefined ;
627627 }
628628}
629629
630630export function isDirSafe ( path : fs . PathLike ) : boolean {
631- return ! ! fs . statSync ( path , { throwIfNoEntry : false } ) ?. isDirectory ( ) ;
631+ return ! ! statSyncSafe ( path ) ?. isDirectory ( ) ;
632632}
633633
634634export function isFileSafe ( path : fs . PathLike ) : boolean {
635- return ! ! fs . statSync ( path , { throwIfNoEntry : false } ) ?. isFile ( ) ;
635+ return ! ! statSyncSafe ( path ) ?. isFile ( ) ;
636636}
637637
638638// Keeps only the unique entries in an array, optionally with a custom comparison function
You can’t perform that action at this time.
0 commit comments