mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
add logic for finding the root (runtime) directory (#1948)
This commit fixes the root search logic to be as follows: 1) The `--root_dir` command line argument 2) The contents of environment variable INVOKEAI_ROOT 3) The VIRTUAL_ENV environment variable, plus '..' 4) $HOME/invokeai (3) is the new feature. Since we are now recommending to install InvokeAI and its dependencies into the .venv in the root directory, this should be a reliable choice.
This commit is contained in:
parent
7314f1a862
commit
36e6908266
@ -11,12 +11,13 @@ the attributes:
|
||||
'''
|
||||
|
||||
import os
|
||||
import os.path as osp
|
||||
from argparse import Namespace
|
||||
|
||||
Globals = Namespace()
|
||||
|
||||
# This is usually overwritten by the command line and/or environment variables
|
||||
Globals.root = os.path.abspath(os.environ.get('INVOKEAI_ROOT') or os.path.expanduser('~/invokeai'))
|
||||
Globals.root = osp.abspath(os.environ.get('INVOKEAI_ROOT') or osp.abspath(osp.join(os.environ.get('VIRTUAL_ENV'),'..')) or osp.expanduser('~/invokeai'))
|
||||
|
||||
# Where to look for the initialization file
|
||||
Globals.initfile = 'invokeai.init'
|
||||
|
Loading…
Reference in New Issue
Block a user