mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-06 15:14:59 -06:00
easy 7-zip mod for 23.01: rebased from 19.00
This commit is contained in:
committed by
shunf4
parent
082657f61b
commit
18725aeba6
@@ -15,6 +15,7 @@
|
||||
#include "../FileManager/LangUtils.h"
|
||||
#include "../FileManager/resourceGui.h"
|
||||
#include "../FileManager/OverwriteDialogRes.h"
|
||||
#include "../FileManager/ViewSettings.h"
|
||||
|
||||
#include "../Common/ArchiveExtractCallback.h"
|
||||
#include "../Common/PropIDUtils.h"
|
||||
@@ -33,6 +34,7 @@
|
||||
using namespace NWindows;
|
||||
using namespace NFile;
|
||||
using namespace NDir;
|
||||
extern bool g_bProcessError;
|
||||
|
||||
static const wchar_t * const kIncorrectOutDir = L"Incorrect output directory path";
|
||||
|
||||
@@ -152,10 +154,10 @@ HRESULT CThreadExtracting::ProcessVirt()
|
||||
AddSizePair(s, IDS_PROP_ALT_STREAMS_SIZE, Stat.AltStreams_UnpackSize);
|
||||
}
|
||||
s.Add_LF();
|
||||
AddLangString(s, IDS_MESSAGE_NO_ERRORS);
|
||||
FinalMessage.OkMessage.Title = Title;
|
||||
FinalMessage.OkMessage.Message = s;
|
||||
}
|
||||
AddLangString(s, IDS_MESSAGE_NO_ERRORS);
|
||||
FinalMessage.OkMessage.Title = Title;
|
||||
FinalMessage.OkMessage.Message = s;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -181,7 +183,11 @@ HRESULT ExtractGUI(
|
||||
CExtractCallbackImp *extractCallback,
|
||||
HWND hwndParent)
|
||||
{
|
||||
bool openOutputFolder = false;
|
||||
bool deleteSourceFile = false;
|
||||
|
||||
messageWasDisplayed = false;
|
||||
g_bProcessError = false;
|
||||
|
||||
CThreadExtracting extracter;
|
||||
/*
|
||||
@@ -239,6 +245,9 @@ HRESULT ExtractGUI(
|
||||
options.PathMode = dialog.PathMode;
|
||||
options.ElimDup = dialog.ElimDup;
|
||||
|
||||
openOutputFolder = dialog.m_bOpenOutputFolder;
|
||||
deleteSourceFile = dialog.m_bDeleteSourceFile;
|
||||
|
||||
#ifndef Z7_SFX
|
||||
// options.NtOptions.AltStreams = dialog.AltStreams;
|
||||
options.NtOptions.NtSecurity = dialog.NtSecurity;
|
||||
@@ -255,7 +264,7 @@ HRESULT ExtractGUI(
|
||||
NName::NormalizeDirPathPrefix(options.OutputDir);
|
||||
|
||||
/*
|
||||
if (!CreateComplexDirectory(options.OutputDir))
|
||||
if(!CreateComplexDirectory(options.OutputDir))
|
||||
{
|
||||
UString s = GetUnicodeString(NError::MyFormatMessage(GetLastError()));
|
||||
UString s2 = MyFormatNew(IDS_CANNOT_CREATE_FOLDER,
|
||||
@@ -293,5 +302,33 @@ HRESULT ExtractGUI(
|
||||
|
||||
RINOK(extracter.Create(title, hwndParent))
|
||||
messageWasDisplayed = extracter.ThreadFinishedOK && extracter.MessagesDisplayed;
|
||||
if (extracter.ThreadFinishedOK && !g_bProcessError)
|
||||
{
|
||||
if (openOutputFolder)
|
||||
{
|
||||
StartApplication(options.OutputDir, options.OutputDir);
|
||||
}
|
||||
if (deleteSourceFile)
|
||||
{
|
||||
DWORD dwAttr;
|
||||
UString strFilePath;
|
||||
for (unsigned i = 0; i < archivePathsFull.Size(); i++)
|
||||
{
|
||||
strFilePath = archivePathsFull[i];
|
||||
dwAttr = GetFileAttributesW(strFilePath);
|
||||
|
||||
if ((dwAttr != INVALID_FILE_ATTRIBUTES)
|
||||
&& (dwAttr & FILE_ATTRIBUTE_ARCHIVE))
|
||||
{
|
||||
if (dwAttr & FILE_ATTRIBUTE_READONLY)
|
||||
{
|
||||
dwAttr &= (~FILE_ATTRIBUTE_READONLY);
|
||||
SetFileAttributesW(strFilePath, dwAttr);
|
||||
}
|
||||
::DeleteFileW(strFilePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return extracter.Result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user