diff --git a/programs/cmm/downloader/dl.c b/programs/cmm/downloader/dl.c index f87e55be43..74d6bf8795 100644 --- a/programs/cmm/downloader/dl.c +++ b/programs/cmm/downloader/dl.c @@ -1,5 +1,5 @@ #define MEMSIZE 1024 * 40 -//Copyright 2020 by Leency +//Copyright 2020 - 2021 by Leency #include "../lib/gui.h" #include "../lib/random.h" #include "../lib/obj/box_lib.h" @@ -181,22 +181,32 @@ void MonitorProgress() StartDownloading(); return; } - SaveFile(); + SaveFile(0); if (exit_param) ExitProcess(); StopDownloading(); DrawWindow(); } } -void SaveFile() +void SaveFile(int attempt) { - int i; + int i, fi=0; char notify_message[4296]; char file_name[URL_SIZE+96]; strcpy(#filepath, #save_dir); chrcat(#filepath, '/'); + if (attempt > 9) { + notify("'Too many saving attempts' -E"); + return; + } + + if (attempt > 0) { + chrcat(#filepath, attempt+'0'); + chrcat(#filepath, '_'); + } + //Content-Disposition: attachment; filename="RealFootball_2018_Nokia_5800_EN_IGP_EU_TS_101.zip" if (http.header_field("content-disposition", #file_name, sizeof(file_name))) { if (EDX = strstr(#file_name,"filename=\"")) { @@ -214,6 +224,11 @@ void SaveFile() for (i=0; i