Origial James Hoo mod to 16.04

This commit is contained in:
shunf4
2024-04-20 18:55:53 +08:00
parent 603abd5528
commit eaa3e8b48c
86 changed files with 55401 additions and 185 deletions

View File

@@ -34,6 +34,8 @@ using namespace NWindows;
using namespace NFile;
using namespace NDir;
extern bool g_bProcessError;
static const wchar_t *kIncorrectOutDir = L"Incorrect output directory path";
#ifndef _SFX
@@ -160,7 +162,11 @@ HRESULT ExtractGUI(
CExtractCallbackImp *extractCallback,
HWND hwndParent)
{
bool openOutputFolder = false;
bool deleteSourceFile = false;
messageWasDisplayed = false;
g_bProcessError = false;
CThreadExtracting extracter;
extracter.codecs = codecs;
@@ -213,6 +219,9 @@ HRESULT ExtractGUI(
options.PathMode = dialog.PathMode;
options.ElimDup = dialog.ElimDup;
openOutputFolder = dialog.m_bOpenOutputFolder;
deleteSourceFile = dialog.m_bDeleteSourceFile;
#ifndef _SFX
// options.NtOptions.AltStreams = dialog.AltStreams;
options.NtOptions.NtSecurity = dialog.NtSecurity;
@@ -229,7 +238,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,
@@ -268,5 +277,34 @@ HRESULT ExtractGUI(
RINOK(extracter.Create(title, hwndParent));
messageWasDisplayed = extracter.ThreadFinishedOK &
extracter.ProgressDialog.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;
}