Minor refactoring of SD dir variables

This commit is contained in:
cmdr2 2024-09-24 17:40:00 +05:30
parent 6559c41b2e
commit a0de0b5814

View File

@ -36,10 +36,10 @@ ROOT_DIR = os.path.abspath(os.path.join(SD_DIR, ".."))
SD_UI_DIR = os.getenv("SD_UI_PATH", None) SD_UI_DIR = os.getenv("SD_UI_PATH", None)
CONFIG_DIR = os.path.abspath(os.path.join(SD_UI_DIR, "..", "scripts")) CONFIG_DIR = os.path.abspath(os.path.join(ROOT_DIR, "scripts"))
BUCKET_DIR = os.path.abspath(os.path.join(SD_DIR, "..", "bucket")) BUCKET_DIR = os.path.abspath(os.path.join(ROOT_DIR, "bucket"))
USER_PLUGINS_DIR = os.path.abspath(os.path.join(SD_DIR, "..", "plugins")) USER_PLUGINS_DIR = os.path.abspath(os.path.join(ROOT_DIR, "plugins"))
CORE_PLUGINS_DIR = os.path.abspath(os.path.join(SD_UI_DIR, "plugins")) CORE_PLUGINS_DIR = os.path.abspath(os.path.join(SD_UI_DIR, "plugins"))
USER_UI_PLUGINS_DIR = os.path.join(USER_PLUGINS_DIR, "ui") USER_UI_PLUGINS_DIR = os.path.join(USER_PLUGINS_DIR, "ui")
@ -77,7 +77,7 @@ IMAGE_EXTENSIONS = [
".avif", ".avif",
".svg", ".svg",
] ]
CUSTOM_MODIFIERS_DIR = os.path.abspath(os.path.join(SD_DIR, "..", "modifiers")) CUSTOM_MODIFIERS_DIR = os.path.abspath(os.path.join(ROOT_DIR, "modifiers"))
CUSTOM_MODIFIERS_PORTRAIT_EXTENSIONS = [ CUSTOM_MODIFIERS_PORTRAIT_EXTENSIONS = [
".portrait", ".portrait",
"_portrait", "_portrait",
@ -91,7 +91,7 @@ CUSTOM_MODIFIERS_LANDSCAPE_EXTENSIONS = [
"-landscape", "-landscape",
] ]
MODELS_DIR = os.path.abspath(os.path.join(SD_DIR, "..", "models")) MODELS_DIR = os.path.abspath(os.path.join(ROOT_DIR, "models"))
def init(): def init():
@ -105,7 +105,7 @@ def init():
config = getConfig() config = getConfig()
config_models_dir = config.get("models_dir", None) config_models_dir = config.get("models_dir", None)
if (config_models_dir is not None and config_models_dir != ""): if config_models_dir is not None and config_models_dir != "":
MODELS_DIR = config_models_dir MODELS_DIR = config_models_dir