mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2026-05-07 00:41:50 +00:00
prioritize cwd for downloads if its writable
This commit is contained in:
parent
f50840455b
commit
08c0246f24
1 changed files with 8 additions and 3 deletions
11
koboldcpp.py
11
koboldcpp.py
|
|
@ -6492,9 +6492,14 @@ def downloader_internal(input_url, output_filename, capture_output, min_file_siz
|
|||
if "https://huggingface.co/" in input_url and "/blob/main/" in input_url:
|
||||
input_url = input_url.replace("/blob/main/", "/resolve/main/")
|
||||
if output_filename == "auto":
|
||||
exe_dir = os.path.dirname(sys.executable if getattr(sys, 'frozen', False) else __file__)
|
||||
filename = os.path.basename(input_url).split('?')[0].split('#')[0]
|
||||
output_filename = os.path.join(exe_dir, filename)
|
||||
cwd = os.getcwd()
|
||||
test_writable = os.access(cwd, os.W_OK)
|
||||
if test_writable:
|
||||
output_filename = os.path.basename(input_url).split('?')[0].split('#')[0]
|
||||
else:
|
||||
exe_dir = os.path.dirname(sys.executable if getattr(sys, 'frozen', False) else __file__)
|
||||
filename = os.path.basename(input_url).split('?')[0].split('#')[0]
|
||||
output_filename = os.path.join(exe_dir, filename)
|
||||
incomplete_dl_exist = (os.path.exists(output_filename+".aria2") and os.path.getsize(output_filename+".aria2") > 16)
|
||||
if os.path.exists(output_filename) and os.path.getsize(output_filename) > min_file_size and not incomplete_dl_exist:
|
||||
print(f"{output_filename} already exists, using existing file.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue