@@ -6507,19 +6507,25 @@ def downloader_internal(input_url, output_filename, capture_output, min_file_siz
65076507            basepath  =  os .path .abspath (os .path .dirname (__file__ ))
65086508            a2cexe  =  (os .path .join (basepath , "aria2c-win.exe" ))
65096509            if  os .path .exists (a2cexe ): #on windows try using embedded a2cexe 
6510+                 out_dir  =  os .path .dirname (output_filename )
6511+                 out_name  =  os .path .basename (output_filename )
65106512                rc  =  subprocess .run ([
65116513                        a2cexe , "-x" , "16" , "-s" , "16" , "--summary-interval=15" , "--console-log-level=error" , "--log-level=error" ,
6512-                         "--download-result=default" , "--continue=true" , "--allow-overwrite=true" , "--file-allocation=none" , "--max-tries=3" , "-o" , output_filename , input_url 
6514+                         "--download-result=default" , "--continue=true" , "--allow-overwrite=true" , "--file-allocation=none" , "--max-tries=3" ,
6515+                         "-d" , out_dir , "-o" , out_name , input_url 
65136516                    ], capture_output = capture_output , text = True , check = True , encoding = 'utf-8' )
65146517                dl_success  =  (rc .returncode  ==  0  and  os .path .exists (output_filename ) and  os .path .getsize (output_filename ) >  min_file_size )
65156518    except  subprocess .CalledProcessError  as  e :
65166519        print (f"aria2c-win failed: { e }  " )
65176520
65186521    try :
65196522        if  not  dl_success  and  shutil .which ("aria2c" ) is  not   None :
6523+             out_dir  =  os .path .dirname (output_filename )
6524+             out_name  =  os .path .basename (output_filename )
65206525            rc  =  subprocess .run ([
65216526                    "aria2c" , "-x" , "16" , "-s" , "16" , "--summary-interval=15" , "--console-log-level=error" , "--log-level=error" ,
6522-                     "--download-result=default" , "--allow-overwrite=true" , "--file-allocation=none" , "--max-tries=3" , "-o" , output_filename , input_url 
6527+                     "--download-result=default" , "--allow-overwrite=true" , "--file-allocation=none" , "--max-tries=3" ,
6528+                     "-d" , out_dir , "-o" , out_name , input_url 
65236529                ], capture_output = capture_output , text = True , check = True , encoding = 'utf-8' )
65246530            dl_success  =  (rc .returncode  ==  0  and  os .path .exists (output_filename ) and  os .path .getsize (output_filename ) >  min_file_size )
65256531    except  subprocess .CalledProcessError  as  e :
0 commit comments