This commit is contained in:
Igor Pavlov
2018-12-30 14:01:47 +00:00
committed by Kornel
parent 18dc2b4161
commit 5b2a99c548
113 changed files with 1805 additions and 932 deletions
+25 -1
View File
@@ -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