if no existing filepath, do not use cwd, use last path instead

This commit is contained in:
Concedo 2024-03-11 22:19:38 +08:00
parent 4dd1c2b81a
commit 9229ea664e
2 changed files with 4 additions and 4 deletions

View file

@ -10521,7 +10521,7 @@ Current version: 123
gametext_arr.push(nimgtag); gametext_arr.push(nimgtag);
image_db[data.id] = { done: false, queue: "Starting", result: "", prompt:sentence, local:false }; image_db[data.id] = { done: false, queue: "Starting", result: "", prompt:sentence, local:false };
image_db[data.id].aspect = (iwidth>iheight?2:(iwidth<iheight?1:0)); image_db[data.id].aspect = (iwidth>iheight?2:(iwidth<iheight?1:0));
image_db[imgid].imsource = 0; //0=generated,1=uploaded image_db[data.id].imsource = 0; //0=generated,1=uploaded
console.log("New image queued " + nimgtag); console.log("New image queued " + nimgtag);
} }
else { else {

View file

@ -1574,7 +1574,7 @@ def show_new_gui():
makelabel(parent, text, row,0,tooltiptxt) makelabel(parent, text, row,0,tooltiptxt)
def getfilename(var, text): def getfilename(var, text):
initialDir = os.path.dirname(var.get()) initialDir = os.path.dirname(var.get())
initialDir = initialDir if os.path.isdir(initialDir) else os.getcwd() initialDir = initialDir if os.path.isdir(initialDir) else None
fnam = askopenfilename(title=text,filetypes=filetypes, initialdir=initialDir) fnam = askopenfilename(title=text,filetypes=filetypes, initialdir=initialDir)
if fnam: if fnam:
var.set(fnam) var.set(fnam)
@ -2232,7 +2232,7 @@ def show_new_gui():
file_type = [("KoboldCpp Settings", "*.kcpps")] file_type = [("KoboldCpp Settings", "*.kcpps")]
global runmode_untouched global runmode_untouched
runmode_untouched = False runmode_untouched = False
filename = askopenfilename(filetypes=file_type, defaultextension=file_type, initialdir=os.getcwd()) filename = askopenfilename(filetypes=file_type, defaultextension=file_type, initialdir=None)
if not filename or filename=="": if not filename or filename=="":
return return
with open(filename, 'r') as f: with open(filename, 'r') as f: