Skip to content

Commit f6b7fea

Browse files
authored
zentk - folder select workaround (LostRuins#1478)
* zentk - folder select workaround * kcppt extention fix
1 parent 8fd70f3 commit f6b7fea

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

koboldcpp.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3528,7 +3528,11 @@ def zenity(typ, filetypes=None, initialdir="", initialfile="", **kwargs) -> Tupl
35283528

35293529
def zentk_askopenfilename(**options):
35303530
try:
3531+
from os.path import isfile
35313532
result = zenity('file-selection', filetypes=options.get("filetypes"), initialdir=options.get("initialdir"), title=options.get("title"))[1]
3533+
if result and not isfile(result):
3534+
print("A folder was selected while we need a file, ignoring selection.")
3535+
return ''
35323536
except:
35333537
from tkinter.filedialog import askopenfilename
35343538
result = askopenfilename(**options)
@@ -4420,7 +4424,7 @@ def kcpp_export_template():
44204424
return
44214425
filenamestr = str(filename).strip()
44224426
if not filenamestr.endswith(".kcppt"):
4423-
filenamestr += ".kcpps"
4427+
filenamestr += ".kcppt"
44244428
file = open(filenamestr, 'w')
44254429
file.write(json.dumps(savdict))
44264430
file.close()

0 commit comments

Comments
 (0)