diff options
author | Max Audron <audron@cocaine.farm> | 2023-01-25 17:15:42 +0100 |
---|---|---|
committer | Max Audron <audron@cocaine.farm> | 2023-01-27 14:44:30 +0100 |
commit | 5eee2ac39863f9e44591b50d0710dd2615416a13 (patch) | |
tree | 72d90317db4e724a9d9ace4f9e8d8f2d4467d5e9 /modules/paths.py | |
parent | 9beb794e0b0dc1a0f9e89d8e38bd789a8c608397 (diff) |
add data-dir flag and set all user data directories based on it
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
|