mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-13 18:11:37 -06:00
Update to 7-Zip Version 21.02
This commit is contained in:
@@ -27,30 +27,41 @@ void CAgentFolder::GetPathParts(UStringVector &pathParts, bool &isAltStreamFolde
|
||||
_proxy->GetDirPathParts(_proxyDirIndex, pathParts);
|
||||
}
|
||||
|
||||
static bool DeleteEmptyFolderAndEmptySubFolders(const FString &path)
|
||||
static bool Delete_EmptyFolder_And_EmptySubFolders(const FString &path)
|
||||
{
|
||||
NFind::CFileInfo fileInfo;
|
||||
FString pathPrefix = path;
|
||||
pathPrefix.Add_PathSepar();
|
||||
{
|
||||
NFind::CEnumerator enumerator;
|
||||
enumerator.SetDirPrefix(pathPrefix);
|
||||
while (enumerator.Next(fileInfo))
|
||||
const FString pathPrefix = path + FCHAR_PATH_SEPARATOR;
|
||||
CObjectVector<FString> names;
|
||||
{
|
||||
if (fileInfo.IsDir())
|
||||
if (!DeleteEmptyFolderAndEmptySubFolders(pathPrefix + fileInfo.Name))
|
||||
NFind::CDirEntry fileInfo;
|
||||
NFind::CEnumerator enumerator;
|
||||
enumerator.SetDirPrefix(pathPrefix);
|
||||
for (;;)
|
||||
{
|
||||
bool found;
|
||||
if (!enumerator.Next(fileInfo, found))
|
||||
return false;
|
||||
if (!found)
|
||||
break;
|
||||
if (fileInfo.IsDir())
|
||||
names.Add(fileInfo.Name);
|
||||
}
|
||||
}
|
||||
bool res = true;
|
||||
FOR_VECTOR (i, names)
|
||||
{
|
||||
if (!Delete_EmptyFolder_And_EmptySubFolders(pathPrefix + names[i]))
|
||||
res = false;
|
||||
}
|
||||
if (!res)
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
// we don't need clear readonly for folders
|
||||
// we clear read-only attrib to remove read-only dir
|
||||
if (!SetFileAttrib(path, 0))
|
||||
return false;
|
||||
*/
|
||||
return RemoveDir(path);
|
||||
}
|
||||
|
||||
|
||||
HRESULT CAgentFolder::CommonUpdateOperation(
|
||||
AGENT_OP operation,
|
||||
bool moveMode,
|
||||
@@ -123,7 +134,7 @@ HRESULT CAgentFolder::CommonUpdateOperation(
|
||||
case AGENT_OP_Uni:
|
||||
{
|
||||
Byte actionSetByte[NUpdateArchive::NPairState::kNumValues];
|
||||
for (int i = 0; i < NUpdateArchive::NPairState::kNumValues; i++)
|
||||
for (unsigned i = 0; i < NUpdateArchive::NPairState::kNumValues; i++)
|
||||
actionSetByte[i] = (Byte)actionSet->StateActions[i];
|
||||
result = _agentSpec->DoOperation2(
|
||||
moveMode ? &requestedPaths : NULL,
|
||||
@@ -162,7 +173,7 @@ HRESULT CAgentFolder::CommonUpdateOperation(
|
||||
{
|
||||
const FString &fs = requestedPaths[i];
|
||||
if (NFind::DoesDirExist(fs))
|
||||
DeleteEmptyFolderAndEmptySubFolders(fs);
|
||||
Delete_EmptyFolder_And_EmptySubFolders(fs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user