mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-04 13:22:39 +02:00
Set current working directory (cwd) to default project root in PyPI mode
This commit is contained in:
parent
68f3865893
commit
355ee8faa8
1 changed files with 6 additions and 0 deletions
|
|
@ -23,6 +23,12 @@ OPTIONS = contextvars.ContextVar("OPTIONS", default={})
|
|||
def get_metagpt_package_root():
|
||||
"""Get the root directory of the installed package."""
|
||||
package_root = Path(metagpt.__file__).parent.parent
|
||||
for i in (".git", ".project_root", ".gitignore"):
|
||||
if (package_root / i).exists():
|
||||
break
|
||||
else:
|
||||
package_root = Path.cwd()
|
||||
|
||||
logger.info(f"Package root set to {str(package_root)}")
|
||||
return package_root
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue