Update install.py

Signed-off-by: Mithun Gowda B <mithungowda.b7411@gmail.com>
This commit is contained in:
Mithun Gowda B
2025-07-21 11:34:00 +05:30
committed by GitHub
parent 8c54fc38d8
commit 3a8e245a91

View File

@@ -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)
return operation.handle_operation_error("install", e)