Fixes #130
This commit is contained in:
parent
299e2446b0
commit
55791cc88e
@ -155,7 +155,11 @@ export class DiskSpacePrimitives implements SpacePrimitives {
|
|||||||
const file of walk(this.rootPath, {
|
const file of walk(this.rootPath, {
|
||||||
includeDirs: false,
|
includeDirs: false,
|
||||||
// Exclude hidden directories
|
// Exclude hidden directories
|
||||||
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)
|
||||||
|
new RegExp(`^${escapeRegExp(this.rootPath)}.*\\/\\..+$`),
|
||||||
|
],
|
||||||
})
|
})
|
||||||
) {
|
) {
|
||||||
const fullPath = file.path;
|
const fullPath = file.path;
|
||||||
@ -194,3 +198,7 @@ export class DiskSpacePrimitives implements SpacePrimitives {
|
|||||||
return plug.syscall(name, args);
|
return plug.syscall(name, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function escapeRegExp(string: string) {
|
||||||
|
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user