Fixes #518
parent
79611a27e0
commit
bdb4159f5b
|
@ -78,7 +78,11 @@ export default function fileSystemSyscalls(root = "/"): SysCallMapping {
|
|||
const file of walk(dirPath, {
|
||||
includeDirs: false,
|
||||
// Exclude hidden files
|
||||
skip: [/^.*\/\..+$/],
|
||||
skip: [
|
||||
// Dynamically builds a regexp that matches hidden directories INSIDE the rootPath
|
||||
// (but if the rootPath is hidden, it stil lists files inside of it, fixing #130 and #518)
|
||||
new RegExp(`^${escapeRegExp(root)}.*\\/\\..+$`),
|
||||
],
|
||||
maxDepth: recursive ? Infinity : 1,
|
||||
})
|
||||
) {
|
||||
|
@ -97,3 +101,7 @@ export default function fileSystemSyscalls(root = "/"): SysCallMapping {
|
|||
},
|
||||
};
|
||||
}
|
||||
|
||||
function escapeRegExp(string: string) {
|
||||
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue