hyyly / csexwb2

Automatically exported from code.google.com/p/csexwb2
0 stars 0 forks source link

Downloading to an existing file does not overwrite #64

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When you download to an existing file, the file is not truncated.

What steps will reproduce the problem?
1. Download something to a new file.
2. Download something smaller to the same file.

To fix the issue, in UtilMan.cpp, line 1252, simply replace:
    hFile = CreateFile(OLE2T(fFullSavePath), GENERIC_WRITE, 0, NULL,
       OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
with: 
    hFile = CreateFile(OLE2T(fFullSavePath), GENERIC_WRITE, 0, NULL,
       CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);

CREATE_ALWAYS will overwrite the existing file instead of opening it.

Original issue reported on code.google.com by Alexis.S...@gmail.com on 11 Dec 2008 at 10:43