mirror of
https://github.com/Xevion/easy7zip.git
synced 2026-02-01 14:24:14 -06:00
18.06
This commit is contained in:
@@ -1182,7 +1182,9 @@ if (askExtractMode == NArchive::NExtract::NAskMode::kExtract && !_testMode)
|
||||
bool needDelete = true;
|
||||
if (needDelete)
|
||||
{
|
||||
if (NFind::DoesFileExist(fullProcessedPath))
|
||||
if (!DeleteFileAlways(fullProcessedPath))
|
||||
if (GetLastError() != ERROR_FILE_NOT_FOUND)
|
||||
{
|
||||
RINOK(SendMessageError_with_LastError(kCantDeleteOutputFile, fullProcessedPath));
|
||||
return S_OK;
|
||||
@@ -1368,13 +1370,35 @@ if (askExtractMode == NArchive::NExtract::NAskMode::kExtract && !_testMode)
|
||||
// UInt64 ticks = GetCpuTicks();
|
||||
bool res = _outFileStreamSpec->File.SetLength(_curSize);
|
||||
_fileLengthWasSet = res;
|
||||
_outFileStreamSpec->File.SeekToBegin();
|
||||
|
||||
// ticks = GetCpuTicks() - ticks;
|
||||
// printf("\nticks = %10d\n", (unsigned)ticks);
|
||||
if (!res)
|
||||
{
|
||||
RINOK(SendMessageError_with_LastError(kCantSetFileLen, fullProcessedPath));
|
||||
}
|
||||
|
||||
/*
|
||||
_outFileStreamSpec->File.Close();
|
||||
ticks = GetCpuTicks() - ticks;
|
||||
printf("\nticks = %10d\n", (unsigned)ticks);
|
||||
return S_FALSE;
|
||||
*/
|
||||
|
||||
/*
|
||||
File.SetLength() on FAT (xp64): is fast, but then File.Close() can be slow,
|
||||
if we don't write any data.
|
||||
File.SetLength() for remote share file (exFAT) can be slow in some cases,
|
||||
and the Windows can return "network error" after 1 minute,
|
||||
while remote file still can grow.
|
||||
We need some way to detect such bad cases and disable PreAllocateOutFile mode.
|
||||
*/
|
||||
|
||||
res = _outFileStreamSpec->File.SeekToBegin();
|
||||
if (!res)
|
||||
{
|
||||
RINOK(SendMessageError_with_LastError("Can not seek to begin of file", fullProcessedPath));
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SUPPORT_ALT_STREAMS
|
||||
|
||||
Reference in New Issue
Block a user