fix: hidden files on Windows visible made visible by search
Massimo Melina committed
Mar 18, 2023 at 23:29 UTC
89b4e27bf331df23120dde83a16ec2bb93ff527a
1 file changed
+4
-2
src/util-files.ts
+4
-2
@@ -103,9 +103,11 @@ export async function* dirStream(path: string, deep?: number) {
103
104
async function getItemsToSkip(path: string) {
105
if (!IS_WINDOWS) return
106
- const out = await runCmd('dir', ['/ah', '/b', path.replace(/\//g, '\\')])
106
+ const winPath = path.replace(/\//g, '\\')
107
+ const out = await runCmd('dir', ['/ah', '/b', deep ? '/s' : '', winPath])
108
.catch(()=>'') // error in case of no matching file
108
- return out.split('\r\n').slice(0,-1)
109
+ return out.split('\r\n').slice(0,-1).map(x =>
110
+ !deep ? x : x.slice(winPath.length + 1).replace(/\\/g, '/'))
111
}
112
}
113