InvokeAI icon indicating copy to clipboard operation
InvokeAI copied to clipboard

Fix init file creation if runtime directory already exists

Open ebr opened this issue 3 years ago • 3 comments

Fixes #1613

ebr avatar Nov 29 '22 09:11 ebr

This is looking good. I'll do a little runtime testing before approving.

lstein avatar Nov 29 '22 14:11 lstein

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?

ebr avatar Nov 30 '22 07:11 ebr

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.

lstein avatar Nov 30 '22 14:11 lstein

Closing this, continued in #1798

ebr avatar Dec 05 '22 09:12 ebr