Skip to content

Commit

Permalink
Fixed bugs
Browse files Browse the repository at this point in the history
Renaming downloading files can be done when the --allow-rename switch is set.
Files can now be opened while downloading (only if --allow-rename is not set).
Guard against spawning multiple instances when one instance setting is enabled.
System Tray icon will reappear if Explorer is reset.
  • Loading branch information
erickutcher committed Jul 7, 2023
1 parent e27fa59 commit f96dc8c
Show file tree
Hide file tree
Showing 108 changed files with 548 additions and 268 deletions.
10 changes: 5 additions & 5 deletions HTTP_Downloader/HTTP_Downloader.rc
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ IDI_ICON_TRAY ICON "icon_tray.ico"
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,5,0
PRODUCTVERSION 1,0,5,0
FILEVERSION 1,0,5,1
PRODUCTVERSION 1,0,5,1
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -81,12 +81,12 @@ BEGIN
BEGIN
VALUE "Comments", "HTTP Downloader is made free under the GPLv3 license."
VALUE "FileDescription", "HTTP Downloader can download files through HTTP(S), FTP(S), and SFTP connections."
VALUE "FileVersion", "1, 0, 5, 0"
VALUE "FileVersion", "1, 0, 5, 1"
VALUE "InternalName", "HTTP Downloader"
VALUE "LegalCopyright", "Copyright � 2015-2022 Eric Kutcher"
VALUE "LegalCopyright", "Copyright � 2015-2023 Eric Kutcher"
VALUE "OriginalFilename", "HTTP_Downloader.exe"
VALUE "ProductName", "HTTP Downloader"
VALUE "ProductVersion", "1, 0, 5, 0"
VALUE "ProductVersion", "1, 0, 5, 1"
END
END
BLOCK "VarFileInfo"
Expand Down
8 changes: 8 additions & 0 deletions HTTP_Downloader/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
Version: 1.0.5.1
Released: 2023-07-07

Renaming downloading files can be done when the --allow-rename switch is set.
Files can now be opened while downloading (only if --allow-rename is not set).
Guard against spawning multiple instances when one instance setting is enabled.
System Tray icon will reappear if Explorer is reset.

Version: 1.0.5.0
Released 2022-09-02

Expand Down
2 changes: 1 addition & 1 deletion HTTP_Downloader/cmessagebox.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
HTTP Downloader can download files through HTTP(S), FTP(S), and SFTP connections.
Copyright (C) 2015-2022 Eric Kutcher
Copyright (C) 2015-2023 Eric Kutcher
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
95 changes: 52 additions & 43 deletions HTTP_Downloader/connection.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
HTTP Downloader can download files through HTTP(S), FTP(S), and SFTP connections.
Copyright (C) 2015-2022 Eric Kutcher
Copyright (C) 2015-2023 Eric Kutcher
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -8055,7 +8055,7 @@ void CleanupConnection( SOCKET_CONTEXT *context )
{
incomplete_download = false;

di->status = context->status;
di->status = context->status & ~STATUS_DELETE;
}
}
else if ( di->status != STATUS_FILE_IO_ERROR && di->status != STATUS_INSUFFICIENT_DISK_SPACE )
Expand Down Expand Up @@ -8275,64 +8275,73 @@ void CleanupConnection( SOCKET_CONTEXT *context )

GlobalFree( shared_info->w_add_time );

// Do we want to delete the file as well?
if ( !( shared_info->download_operations & DOWNLOAD_OPERATION_SIMULATE ) &&
IS_STATUS( context->status, STATUS_DELETE ) )
{
wchar_t *file_path_delete;
free_shared_info = true;
}

wchar_t file_path[ MAX_PATH + 1 ];
if ( cfg_use_temp_download_directory )
{
GetTemporaryFilePath( shared_info, file_path );
// Do we want to delete the file as well?
if ( !( shared_info->download_operations & DOWNLOAD_OPERATION_SIMULATE ) &&
IS_STATUS( context->status, STATUS_DELETE ) )
{
wchar_t *file_path_delete;

file_path_delete = file_path;
}
else
wchar_t file_path[ MAX_PATH + 1 ];
if ( cfg_use_temp_download_directory )
{
GetTemporaryFilePath( shared_info, file_path );

file_path_delete = file_path;
}
else
{
if ( free_shared_info )
{
// We're freeing this anyway so it's safe to modify.
shared_info->file_path[ shared_info->filename_offset - 1 ] = L'\\'; // Replace the download directory NULL terminator with a directory slash.

file_path_delete = shared_info->file_path;
}

if ( cfg_move_to_trash )
else
{
int file_path_length = lstrlenW( file_path_delete );

if ( file_path[ 0 ] == 0 )
{
_wmemcpy_s( file_path, MAX_PATH + 1, file_path_delete, file_path_length );
}
GetDownloadFilePath( shared_info, file_path );

file_path[ file_path_length ] = 0;
file_path[ file_path_length + 1 ] = 0;
file_path_delete = file_path;
}
}

SHFILEOPSTRUCTW sfos;
_memzero( &sfos, sizeof( SHFILEOPSTRUCTW ) );
sfos.wFunc = FO_DELETE;
sfos.pFrom = file_path;
sfos.fFlags = FOF_ALLOWUNDO | FOF_NO_UI;
if ( cfg_move_to_trash )
{
int file_path_length = lstrlenW( file_path_delete );

_SHFileOperationW( &sfos );
}
else
if ( file_path[ 0 ] == 0 )
{
DeleteFileW( file_path_delete );
_wmemcpy_s( file_path, MAX_PATH + 1, file_path_delete, file_path_length );
}

#ifdef ENABLE_LOGGING
wchar_t *l_file_path;
wchar_t t_l_file_path[ MAX_PATH ];
bool is_temp = false;
if ( cfg_use_temp_download_directory && shared_info->status != STATUS_COMPLETED ) { GetTemporaryFilePath( shared_info, t_l_file_path ); is_temp = true; }
else { GetDownloadFilePath( shared_info, t_l_file_path ); }
l_file_path = t_l_file_path;
WriteLog( LOG_INFO_ACTION, "Deleting: %s%S", ( is_temp ? "temp | " : "" ), l_file_path );
#endif
file_path[ file_path_length ] = 0;
file_path[ file_path_length + 1 ] = 0;

SHFILEOPSTRUCTW sfos;
_memzero( &sfos, sizeof( SHFILEOPSTRUCTW ) );
sfos.wFunc = FO_DELETE;
sfos.pFrom = file_path;
sfos.fFlags = FOF_ALLOWUNDO | FOF_NO_UI;

_SHFileOperationW( &sfos );
}
else
{
DeleteFileW( file_path_delete );
}

free_shared_info = true;
#ifdef ENABLE_LOGGING
wchar_t *l_file_path;
wchar_t t_l_file_path[ MAX_PATH ];
bool is_temp = false;
if ( cfg_use_temp_download_directory && shared_info->status != STATUS_COMPLETED ) { GetTemporaryFilePath( shared_info, t_l_file_path ); is_temp = true; }
else { GetDownloadFilePath( shared_info, t_l_file_path ); }
l_file_path = t_l_file_path;
WriteLog( LOG_INFO_ACTION, "Deleting: %s%S", ( is_temp ? "temp | " : "" ), l_file_path );
#endif
}
}

Expand Down
2 changes: 1 addition & 1 deletion HTTP_Downloader/connection.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
HTTP Downloader can download files through HTTP(S), FTP(S), and SFTP connections.
Copyright (C) 2015-2022 Eric Kutcher
Copyright (C) 2015-2023 Eric Kutcher
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion HTTP_Downloader/dark_mode.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
HTTP Downloader can download files through HTTP(S), FTP(S), and SFTP connections.
Copyright (C) 2015-2022 Eric Kutcher
Copyright (C) 2015-2023 Eric Kutcher
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion HTTP_Downloader/dark_mode.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
HTTP Downloader can download files through HTTP(S), FTP(S), and SFTP connections.
Copyright (C) 2015-2022 Eric Kutcher
Copyright (C) 2015-2023 Eric Kutcher
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion HTTP_Downloader/dllrbt.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
HTTP Downloader can download files through HTTP(S), FTP(S), and SFTP connections.
Copyright (C) 2015-2022 Eric Kutcher
Copyright (C) 2015-2023 Eric Kutcher
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion HTTP_Downloader/dllrbt.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
HTTP Downloader can download files through HTTP(S), FTP(S), and SFTP connections.
Copyright (C) 2015-2022 Eric Kutcher
Copyright (C) 2015-2023 Eric Kutcher
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
8 changes: 4 additions & 4 deletions HTTP_Downloader/dm_version.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
16778496
https://github.com/erickutcher/httpdownloader/releases/download/v1.0.5.0/HTTP_Downloader_DM_32.zip
16778496
https://github.com/erickutcher/httpdownloader/releases/download/v1.0.5.0/HTTP_Downloader_DM_64.zip
16778497
https://github.com/erickutcher/httpdownloader/releases/download/v1.0.5.1/HTTP_Downloader_DM_32.zip
16778497
https://github.com/erickutcher/httpdownloader/releases/download/v1.0.5.1/HTTP_Downloader_DM_64.zip
2 changes: 1 addition & 1 deletion HTTP_Downloader/doublylinkedlist.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
HTTP Downloader can download files through HTTP(S), FTP(S), and SFTP connections.
Copyright (C) 2015-2022 Eric Kutcher
Copyright (C) 2015-2023 Eric Kutcher
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion HTTP_Downloader/doublylinkedlist.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
HTTP Downloader can download files through HTTP(S), FTP(S), and SFTP connections.
Copyright (C) 2015-2022 Eric Kutcher
Copyright (C) 2015-2023 Eric Kutcher
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion HTTP_Downloader/drag_and_drop.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
HTTP Downloader can download files through HTTP(S), FTP(S), and SFTP connections.
Copyright (C) 2015-2022 Eric Kutcher
Copyright (C) 2015-2023 Eric Kutcher
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion HTTP_Downloader/drag_and_drop.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
HTTP Downloader can download files through HTTP(S), FTP(S), and SFTP connections.
Copyright (C) 2015-2022 Eric Kutcher
Copyright (C) 2015-2023 Eric Kutcher
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion HTTP_Downloader/drop_window.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
HTTP Downloader can download files through HTTP(S), FTP(S), and SFTP connections.
Copyright (C) 2015-2022 Eric Kutcher
Copyright (C) 2015-2023 Eric Kutcher
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
Loading

0 comments on commit f96dc8c

Please sign in to comment.