mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-12 03:09:57 -06:00
9.21
This commit is contained in:
committed by
Kornel Lesiński
parent
de4f8c22fe
commit
35596517f2
@@ -2,20 +2,11 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Windows/FileDir.h"
|
||||
|
||||
#include "../Common/WorkDir.h"
|
||||
|
||||
#include "Messages.h"
|
||||
#include "Plugin.h"
|
||||
#include "UpdateCallback100.h"
|
||||
|
||||
using namespace NFar;
|
||||
using namespace NWindows;
|
||||
using namespace NFile;
|
||||
using namespace NDirectory;
|
||||
|
||||
static LPCWSTR kTempArchivePrefix = L"7zA";
|
||||
|
||||
int CPlugin::DeleteFiles(PluginPanelItem *panelItems, int numItems, int opMode)
|
||||
{
|
||||
@@ -67,18 +58,10 @@ int CPlugin::DeleteFiles(PluginPanelItem *panelItems, int numItems, int opMode)
|
||||
g_StartupInfo.GetMsgString(NMessageID::kDeleting), 48);
|
||||
}
|
||||
|
||||
NWorkDir::CInfo workDirInfo;
|
||||
workDirInfo.Load();
|
||||
|
||||
UString workDir = GetWorkDir(workDirInfo, m_FileName);
|
||||
CreateComplexDirectory(workDir);
|
||||
|
||||
CTempFileW tempFile;
|
||||
UString tempFileName;
|
||||
if (tempFile.Create(workDir, kTempArchivePrefix, tempFileName) == 0)
|
||||
CWorkDirTempFile tempFile;
|
||||
if (tempFile.CreateTempFile(m_FileName) != S_OK)
|
||||
return FALSE;
|
||||
|
||||
|
||||
CRecordVector<UINT32> indices;
|
||||
indices.Reserve(numItems);
|
||||
int i;
|
||||
@@ -101,61 +84,23 @@ int CPlugin::DeleteFiles(PluginPanelItem *panelItems, int numItems, int opMode)
|
||||
outArchive->SetFolder(_folder);
|
||||
|
||||
CUpdateCallback100Imp *updateCallbackSpec = new CUpdateCallback100Imp;
|
||||
CMyComPtr<IFolderArchiveUpdateCallback> updateCallback(updateCallbackSpec );
|
||||
CMyComPtr<IFolderArchiveUpdateCallback> updateCallback(updateCallbackSpec);
|
||||
|
||||
updateCallbackSpec->Init(/* m_ArchiveHandler, */ progressBoxPointer);
|
||||
|
||||
|
||||
result = outArchive->DeleteItems(
|
||||
tempFileName,
|
||||
&indices.Front(), indices.Size(),
|
||||
updateCallback);
|
||||
result = outArchive->DeleteItems(tempFile.OutStream, &indices.Front(), indices.Size(), updateCallback);
|
||||
updateCallback.Release();
|
||||
outArchive.Release();
|
||||
|
||||
if (result == S_OK)
|
||||
{
|
||||
result = AfterUpdate(tempFile, pathVector);
|
||||
}
|
||||
if (result != S_OK)
|
||||
{
|
||||
ShowErrorMessage(result);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
_folder.Release();
|
||||
m_ArchiveHandler->Close();
|
||||
|
||||
if (!DeleteFileAlways(m_FileName))
|
||||
{
|
||||
ShowLastErrorMessage();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
tempFile.DisableDeleting();
|
||||
if (!MyMoveFile(tempFileName, m_FileName))
|
||||
{
|
||||
ShowLastErrorMessage();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
result = m_ArchiveHandler->ReOpen(NULL);
|
||||
if (result != S_OK)
|
||||
{
|
||||
ShowErrorMessage(result);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////
|
||||
// Restore _folder;
|
||||
|
||||
m_ArchiveHandler->BindToRootFolder(&_folder);
|
||||
for (i = 0; i < pathVector.Size(); i++)
|
||||
{
|
||||
CMyComPtr<IFolderFolder> newFolder;
|
||||
_folder->BindToFolder(pathVector[i], &newFolder);
|
||||
if (!newFolder)
|
||||
break;
|
||||
_folder = newFolder;
|
||||
}
|
||||
GetCurrentDir();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user