From 3a8e245a9195ee423a0490ea6e4cc60f6ea5354a Mon Sep 17 00:00:00 2001 From: Mithun Gowda B Date: Mon, 21 Jul 2025 11:34:00 +0530 Subject: [PATCH] Update install.py Signed-off-by: Mithun Gowda B --- setup/operations/install.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/setup/operations/install.py b/setup/operations/install.py index 621e133..f334957 100644 --- a/setup/operations/install.py +++ b/setup/operations/install.py @@ -416,6 +416,15 @@ def run(args: argparse.Namespace) -> int: operation = InstallOperation() operation.setup_operation_logging(args) logger = get_logger() + # ✅ Inserted validation code + expected_home = Path.home().resolve() + actual_dir = args.install_dir.resolve() + + if not str(actual_dir).startswith(str(expected_home)): + print(f"\n[✗] Installation must be inside your user profile directory.") + print(f" Expected prefix: {expected_home}") + print(f" Provided path: {actual_dir}") + sys.exit(1) try: # Validate global arguments @@ -528,4 +537,4 @@ def run(args: argparse.Namespace) -> int: print(f"\n{Colors.YELLOW}Installation cancelled by user{Colors.RESET}") return 130 except Exception as e: - return operation.handle_operation_error("install", e) \ No newline at end of file + return operation.handle_operation_error("install", e)