add backslash to end of incomplete windows paths

This commit is contained in:
Lincoln Stein 2023-08-06 12:34:35 -04:00
commit 5a6cefb0ea
2 changed files with 5 additions and 5 deletions

View File

@ -18,5 +18,5 @@ SEED_MAX = np.iinfo(np.uint32).max
def get_random_seed(): def get_random_seed():
rng = np.random.default_rng(seed=0) rng = np.random.default_rng(seed=None)
return int(rng.integers(0, SEED_MAX)) return int(rng.integers(0, SEED_MAX))

View File

@ -22,13 +22,13 @@ import PIL.PngImagePlugin
from pathlib import Path from pathlib import Path
from prompt_toolkit import prompt from prompt_toolkit import prompt
from prompt_toolkit.shortcuts import message_dialog from prompt_toolkit.shortcuts import message_dialog
from prompt_toolkit.completion import PathCompleter from prompt_toolkit.completion import PathCompleter
from invokeai.app.services.config import InvokeAIAppConfig from invokeai.app.services.config import InvokeAIAppConfig
app_config = InvokeAIAppConfig.get_config() app_config = InvokeAIAppConfig.get_config()
path_delimiter = '\\' if platform.uname().system=='Windows' else '/' path_delimiter = "\\" if platform.uname().system == "Windows" else "/"
print(path_delimiter) print(path_delimiter)
# release notes # release notes
@ -116,7 +116,7 @@ class Config:
) )
if database_path.endswith(".db") and os.path.isabs(database_path) and os.path.exists(database_path): if database_path.endswith(".db") and os.path.isabs(database_path) and os.path.exists(database_path):
break break
default = database_path + path_delimiter if Path(database_path).is_dir() else database_path default = database_path + path_delimiter if Path(database_path).is_dir() and not database_path.endswith(('\\','/')) else database_path
default = "" default = ""
while True: while True:
@ -130,7 +130,7 @@ class Config:
if outputs_path.endswith("images") and os.path.isabs(outputs_path) and os.path.exists(outputs_path): if outputs_path.endswith("images") and os.path.isabs(outputs_path) and os.path.exists(outputs_path):
break break
default = outputs_path + path_delimiter if Path(outputs_path).is_dir() else outputs_path default = outputs_path + path_delimiter if Path(outputs_path).is_dir() and not database_path.endswith(('\\','/')) else outputs_path
self.database_path = database_path self.database_path = database_path
self.outputs_path = outputs_path self.outputs_path = outputs_path