Add .cache and build to the skip dir list, make filedust run ONLY in the user home directory
This commit is contained in:
@@ -172,6 +172,19 @@ def main(argv: list[str] | None = None) -> int:
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
root = Path(args.path).expanduser()
|
||||
home = Path.home().resolve()
|
||||
root_resolved = root.resolve()
|
||||
|
||||
# Ensure root is inside the user's home directory
|
||||
try:
|
||||
root_resolved.relative_to(home)
|
||||
except ValueError:
|
||||
console.print(
|
||||
f"[red]Error:[/] Refusing to operate outside the user's home directory.\n"
|
||||
f"Requested: {root_resolved}\n"
|
||||
f"Allowed: {home}"
|
||||
)
|
||||
return 1
|
||||
|
||||
if not root.exists():
|
||||
console.print(f"[red]Error:[/] Path not found: {root}")
|
||||
|
||||
@@ -23,7 +23,6 @@ JUNK_DIR_NAMES = {
|
||||
".nox",
|
||||
".tox",
|
||||
".hypothesis",
|
||||
".cache",
|
||||
".gradle",
|
||||
".parcel-cache",
|
||||
".turbo",
|
||||
@@ -31,7 +30,6 @@ JUNK_DIR_NAMES = {
|
||||
".vite",
|
||||
".sass-cache",
|
||||
".sass-cache",
|
||||
"build",
|
||||
"dist",
|
||||
}
|
||||
|
||||
@@ -53,6 +51,8 @@ JUNK_FILE_PATTERNS = [
|
||||
|
||||
# VCS / system dirs
|
||||
SKIP_DIR_NAMES = {
|
||||
".cache",
|
||||
"build",
|
||||
".git",
|
||||
".hg",
|
||||
".svn",
|
||||
|
||||
Reference in New Issue
Block a user