@@ -653,6 +653,9 @@ export class GloblinPath {
653653 private readonly _isFileVal : boolean
654654 private readonly _isSymlinkVal : boolean
655655
656+ /** Whether stat option was enabled (if false, isFile/isDirectory return false like PathScurry) */
657+ private readonly _stat : boolean
658+
656659 /** Lazily resolved PathScurry Path (only created if toPath() is called) */
657660 private _pathScurryPath ?: Path
658661 private _pathScurry ?: PathScurry
@@ -668,30 +671,34 @@ export class GloblinPath {
668671 cwd : string ,
669672 isDirectory : boolean ,
670673 isFile : boolean ,
671- isSymlink : boolean
674+ isSymlink : boolean ,
675+ stat : boolean = false
672676 ) {
673677 this . path = relativePath
674678 this . _cwd = cwd
675679 this . _isDir = isDirectory
676680 this . _isFileVal = isFile
677681 this . _isSymlinkVal = isSymlink
682+ this . _stat = stat
678683 this . name = nodePath . basename ( relativePath ) || relativePath
679684 }
680685
681686 /**
682687 * Returns true if this is a regular file.
683- * Uses cached value from Rust - no filesystem access needed.
688+ * Without stat: true, returns false (unknown type) to match PathScurry behavior.
689+ * With stat: true, uses cached value from Rust - no filesystem access needed.
684690 */
685691 isFile ( ) : boolean {
686- return this . _isFileVal
692+ return this . _stat ? this . _isFileVal : false
687693 }
688694
689695 /**
690696 * Returns true if this is a directory.
691- * Uses cached value from Rust - no filesystem access needed.
697+ * Without stat: true, returns false (unknown type) to match PathScurry behavior.
698+ * With stat: true, uses cached value from Rust - no filesystem access needed.
692699 */
693700 isDirectory ( ) : boolean {
694- return this . _isDir
701+ return this . _stat ? this . _isDir : false
695702 }
696703
697704 /**
@@ -768,7 +775,7 @@ export class GloblinPath {
768775 return undefined
769776 }
770777 // Parent is always a directory
771- return new GloblinPath ( parentPath , this . _cwd , true , false , false )
778+ return new GloblinPath ( parentPath , this . _cwd , true , false , false , this . _stat )
772779 }
773780
774781 /**
@@ -791,15 +798,15 @@ export type GlobPath = Path | GloblinPath
791798 *
792799 * @param data - Native path data from Rust
793800 * @param cwd - Current working directory
794- * @param performLstat - If true, also calls lstat on each result (ignored - type info cached from Rust )
801+ * @param stat - If true, isFile/isDirectory return actual values; otherwise return false (like PathScurry )
795802 * @returns Array of GloblinPath objects
796803 */
797804function convertToPathObjects (
798805 data : NativePathData [ ] ,
799806 cwd : string ,
800- _performLstat : boolean = false
807+ stat : boolean = false
801808) : GloblinPath [ ] {
802- return data . map ( d => new GloblinPath ( d . path , cwd , d . isDirectory , d . isFile , d . isSymlink ) )
809+ return data . map ( d => new GloblinPath ( d . path , cwd , d . isDirectory , d . isFile , d . isSymlink , stat ) )
803810}
804811
805812/**
0 commit comments