Skip to content

Commit d3f9db8

Browse files
committed
fix system32 writability check
1 parent 84a67d2 commit d3f9db8

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

koboldcpp.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6493,8 +6493,12 @@ def downloader_internal(input_url, output_filename, capture_output, min_file_siz
64936493
input_url = input_url.replace("/blob/main/", "/resolve/main/")
64946494
if output_filename == "auto":
64956495
cwd = os.getcwd()
6496-
test_writable = os.access(cwd, os.W_OK)
6497-
if test_writable:
6496+
non_writable = False
6497+
if os.name == "nt":
6498+
parts = [p.lower() for p in os.path.normpath(cwd).split(os.sep)]
6499+
if "windows" in parts and ("system32" in parts or "syswow64" in parts):
6500+
non_writable = True
6501+
if not non_writable:
64986502
output_filename = os.path.basename(input_url).split('?')[0].split('#')[0]
64996503
else:
65006504
exe_dir = os.path.dirname(sys.executable if getattr(sys, 'frozen', False) else __file__)
@@ -7167,6 +7171,9 @@ def kcpp_main_process(launch_args, g_memory=None, gui_launcher=False):
71677171
if args.password and args.password!="":
71687172
password = args.password.strip()
71697173

7174+
print(args)
7175+
print("==========")
7176+
71707177
#handle loading text model
71717178
if args.model_param:
71727179
if not os.path.exists(args.model_param):
@@ -7214,10 +7221,10 @@ def kcpp_main_process(launch_args, g_memory=None, gui_launcher=False):
72147221
args.blasthreads = args.threads
72157222

72167223
modelname = os.path.abspath(args.model_param)
7217-
print(args)
7224+
72187225
# Flush stdout for win32 issue with regards to piping in terminals,
72197226
# especially before handing over to C++ context.
7220-
print(f"==========\nLoading Text Model: {modelname}", flush=True)
7227+
print(f"Loading Text Model: {modelname}", flush=True)
72217228
if not modelname.endswith(".bin") and not modelname.endswith(".gguf"):
72227229
print("WARNING: Selected Text Model does not seem to be a GGUF file! Are you sure you picked the right file?")
72237230
loadok = load_model(modelname)

0 commit comments

Comments
 (0)