change PROJECT_ROOT setting & SoftwareCompany -> Team

This commit is contained in:
garylin2099 2023-11-08 19:42:30 +08:00
parent c6350efd7f
commit 56c2a162ac
10 changed files with 54 additions and 90 deletions

View file

@ -6,7 +6,7 @@
@File : const.py
"""
from pathlib import Path
from loguru import logger
def get_project_root():
"""Search upwards to find the project root directory."""
@ -17,10 +17,14 @@ def get_project_root():
or (current_path / ".project_root").exists()
or (current_path / ".gitignore").exists()
):
# use metagpt with git clone will land here
return current_path
parent_path = current_path.parent
if parent_path == current_path:
raise Exception("Project root not found.")
# use metagpt with pip install will land here
cwd = Path.cwd()
logger.info(f"RPOJECT_ROOT set to current working directory: {str(cwd)}")
return cwd
current_path = parent_path