fix: improve handling of CRAWL4_AI_BASE_DIRECTORY environment variable in setup.py

This commit is contained in:
UncleCode 2024-11-28 20:02:39 +08:00
parent 652d396a81
commit 7d81c17cca

View File

@ -9,7 +9,8 @@ import asyncio
# Create the .crawl4ai folder in the user's home directory if it doesn't exist
# If the folder already exists, remove the cache folder
crawl4ai_folder = Path(os.getenv("CRAWL4_AI_BASE_DIRECTORY")) or Path.home()
base_dir = os.getenv("CRAWL4_AI_BASE_DIRECTORY")
crawl4ai_folder = Path(base_dir) if base_dir else Path.home()
crawl4ai_folder = crawl4ai_folder / ".crawl4ai"
cache_folder = crawl4ai_folder / "cache"
content_folders = [