InvokeAI
InvokeAI copied to clipboard
Fix init file creation if runtime directory already exists
Fixes #1613
This is looking good. I'll do a little runtime testing before approving.
Right, I see the problem - I had the INVOKEAI_ROOT set when testing, so it never hit the code path where get_root() returns None. Sorry about that.
I'd like to step back and refactor this so that there's a single approach to the root dir / initfile location, such that it's not re-implemented in three places in subtly different ways. Would you be opposed to having some of this logic moved to Globals (or a similar shared config module), such that all modules/scripts can take advantage of it?
I very much favor a refactoring, and Globals is a better place to put it than the alternatives (e.g. args). What do you say we reverse the logic and make the invokeai directory the thing that is in a predictable location (unless overridden by --root or the environment variable) and the init file is always located inside the invokeai directory. I think this solves the circularity issue.
Closing this, continued in #1798