Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'CPP/7zip/UI/Far/PluginDelete.cpp')
-rwxr-xr-xCPP/7zip/UI/Far/PluginDelete.cpp67
1 files changed, 6 insertions, 61 deletions
diff --git a/CPP/7zip/UI/Far/PluginDelete.cpp b/CPP/7zip/UI/Far/PluginDelete.cpp
index c8d784c3..3a3df300 100755
--- a/CPP/7zip/UI/Far/PluginDelete.cpp
+++ b/CPP/7zip/UI/Far/PluginDelete.cpp
@@ -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)
- {
- ShowErrorMessage(result);
- return FALSE;
- }
-
- _folder.Release();
- m_ArchiveHandler->Close();
-
- if (!DeleteFileAlways(m_FileName))
+ if (result == S_OK)
{
- ShowLastErrorMessage();
- return FALSE;
+ result = AfterUpdate(tempFile, pathVector);
}
-
- 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;
}