use backslash on Windows systems for autoadded delimiter

This commit is contained in:
Lincoln Stein 2023-08-06 12:29:31 -04:00
parent 4043a4c21c
commit 1a6f5f0860

View File

@ -6,6 +6,7 @@
"""Script to import images into the new database system for 3.0.0""" """Script to import images into the new database system for 3.0.0"""
import os import os
import platform
import datetime import datetime
import shutil import shutil
import locale import locale
@ -21,21 +22,14 @@ 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 yes_no_dialog, message_dialog, input_dialog, button_dialog from prompt_toolkit.shortcuts import message_dialog
from prompt_toolkit.completion import PathCompleter from prompt_toolkit.completion import PathCompleter
from prompt_toolkit.key_binding import KeyBindings
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 '/'
bindings = KeyBindings() print(path_delimiter)
@bindings.add("c-c")
def _(event):
raise KeyboardInterrupt
# release notes # release notes
# "Use All" with size dimensions not selectable in the UI will not load dimensions # "Use All" with size dimensions not selectable in the UI will not load dimensions
@ -122,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 + "/" if Path(database_path).is_dir() else database_path default = database_path + path_delimiter if Path(database_path).is_dir() else database_path
default = "" default = ""
while True: while True:
@ -136,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 + "/" if Path(outputs_path).is_dir() else outputs_path default = outputs_path + path_delimiter if Path(outputs_path).is_dir() else outputs_path
self.database_path = database_path self.database_path = database_path
self.outputs_path = outputs_path self.outputs_path = outputs_path