Fix small bug when the url has a slash at the end

git-svn-id: svn://kolibrios.org@6374 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
guillem 2016-03-25 15:35:48 +00:00
parent 50fdbc1f54
commit 955ed8254c

View File

@ -1,10 +1,10 @@
#ifdef LANG_RUS
#define DL_WINDOW_HEADER "Œ¥­¥¤¦¥à § £à㧮ª"
#define START_DOWNLOADING "<22> ç âì § ª çªã"
#define STOP_DOWNLOADING "Žáâ ­®¢¨âì"
#define SHOW_IN_FOLDER "<22>®ª § âì ¢ ¯ ¯ª¥"
#define OPEN_FILE_TEXT "Žâªàëâì ä ©«"
#define FILE_SAVED_AS "'Œ¥­¥¤¦¥à § £à㧮ª\n” ©« á®åà ­¥­ ª ª "
#define DL_WINDOW_HEADER "Œ¥­¥¤¦¥à § £à㧮ª"
#define START_DOWNLOADING "<22> ç âì § ª çªã"
#define STOP_DOWNLOADING "Žáâ ­®¢¨âì"
#define SHOW_IN_FOLDER "<22>®ª § âì ¢ ¯ ¯ª¥"
#define OPEN_FILE_TEXT "Žâªàëâì ä ©«"
#define FILE_SAVED_AS "'Œ¥­¥¤¦¥à § £à㧮ª\n” ©« á®åà ­¥­ ª ª "
#define KB_RECEIVED " ¯®«ã祭®"
#else
#define DL_WINDOW_HEADER "Download Manager"
@ -26,6 +26,9 @@ progress_bar pb = {0, 170, 51, 225, 12, 0, 0, 100, 0xFFFfff, 0x74DA00, 0x9F9F9F}
byte downloader_opened;
char downloader_stak[4096];
char str[2048];
char aux[2048];
void Downloader()
@ -41,7 +44,7 @@ void Downloader()
loop()
{
WaitEventTimeout(40);
WaitEventTimeout(30);
switch(EAX & 0xFF)
{
CASE evMouse:
@ -84,11 +87,18 @@ void Downloader()
if (!dir_exists(#save_to)) CreateDir(#save_to);
strcpy(#filepath, #save_to);
chrcat(#filepath, '/');
strcat(#filepath, #downloader_edit+strrchr(#downloader_edit, '/'));
// Clean all slashes at the end
strcpy(#aux, #downloader_edit);
while (aux[strlen(#aux)-1] == '/') {
aux[strlen(#aux)-1] = 0;
}
strcat(#filepath, #aux+strrchr(#aux, '/'));
if (WriteFile(downloader.data_downloaded_size, downloader.bufpointer, #filepath)==0)
sprintf(#notify_message, "%s%s%s",FILE_SAVED_AS,#filepath,"' -Dt");
else
sprintf(#notify_message, "%s%s%s","'Download manager\nError! Can\96t save file as ",#filepath,"' -Et");
notify(#notify_message);
StopDownloading();
DL_Draw_Window();
@ -172,5 +182,3 @@ void StopDownloading()
ed.flags = 10b;
DL_Draw_Window();
}