diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-01-28 06:24:40 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-28 06:24:40 +0000 |
commit | ce72af87d3b05c946bc82033786fc340f1c20512 (patch) | |
tree | e02a69bc9b18f36db76590bd6312320685901b5e /modules/paths.py | |
parent | 0834d4ce374225131e025540220c727e352a3e43 (diff) | |
parent | 23a9d5e27390846dea0895a02c04aec9583a4d38 (diff) | |
download | stable-diffusion-webui-gfx803-ce72af87d3b05c946bc82033786fc340f1c20512.tar.gz stable-diffusion-webui-gfx803-ce72af87d3b05c946bc82033786fc340f1c20512.tar.bz2 stable-diffusion-webui-gfx803-ce72af87d3b05c946bc82033786fc340f1c20512.zip |
Merge pull request #7199 from maxaudron/feature/configurable-data-dir
Add flag to store user data sepperate from source code
Diffstat (limited to 'modules/paths.py')
-rw-r--r-- | modules/paths.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/paths.py b/modules/paths.py index 20b3e4d8..08e6f9b9 100644 --- a/modules/paths.py +++ b/modules/paths.py @@ -4,7 +4,15 @@ import sys import modules.safe
script_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
-models_path = os.path.join(script_path, "models")
+
+# Parse the --data-dir flag first so we can use it as a base for our other argument default values
+parser = argparse.ArgumentParser()
+parser.add_argument("--data-dir", type=str, default=os.path.dirname(os.path.dirname(os.path.realpath(__file__))), help="base path where all user data is stored",)
+cmd_opts_pre = parser.parse_known_args()[0]
+data_path = cmd_opts_pre.data_dir
+models_path = os.path.join(data_path, "models")
+
+# data_path = cmd_opts_pre.data
sys.path.insert(0, script_path)
# search for directory of stable diffusion in following places
|