mirror of
https://github.com/Xevion/easy7zip.git
synced 2026-01-31 04:24:11 -06:00
feat: do not set time for sole folder in extraction
This commit is contained in:
@@ -1452,6 +1452,7 @@ STDMETHODIMP CAgentFolder::Extract(const UInt32 *indices,
|
|||||||
UInt32 numItems,
|
UInt32 numItems,
|
||||||
Int32 includeAltStreams,
|
Int32 includeAltStreams,
|
||||||
Int32 replaceAltStreamColon,
|
Int32 replaceAltStreamColon,
|
||||||
|
Int64 soleFolderIndex,
|
||||||
NExtract::NPathMode::EEnum pathMode,
|
NExtract::NPathMode::EEnum pathMode,
|
||||||
NExtract::NOverwriteMode::EEnum overwriteMode,
|
NExtract::NOverwriteMode::EEnum overwriteMode,
|
||||||
const wchar_t *path,
|
const wchar_t *path,
|
||||||
@@ -1529,6 +1530,8 @@ STDMETHODIMP CAgentFolder::Extract(const UInt32 *indices,
|
|||||||
// do we need another base folder for subfolders ?
|
// do we need another base folder for subfolders ?
|
||||||
extractCallbackSpec->DirPathPrefix_for_HashFiles = _agentSpec->_hashBaseFolderPrefix;
|
extractCallbackSpec->DirPathPrefix_for_HashFiles = _agentSpec->_hashBaseFolderPrefix;
|
||||||
|
|
||||||
|
extractCallbackSpec->SoleFolderIndex = soleFolderIndex;
|
||||||
|
|
||||||
CUIntVector realIndices;
|
CUIntVector realIndices;
|
||||||
GetRealIndices(indices, numItems, IntToBool(includeAltStreams),
|
GetRealIndices(indices, numItems, IntToBool(includeAltStreams),
|
||||||
false, // includeFolderSubItemsInFlatMode
|
false, // includeFolderSubItemsInFlatMode
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ STDMETHODIMP CAgentFolder::SetZoneIdMode(NExtract::NZoneIdMode::EEnum zoneMode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP CAgentFolder::CopyTo(Int32 moveMode, const UInt32 *indices, UInt32 numItems,
|
STDMETHODIMP CAgentFolder::CopyTo(Int32 moveMode, const UInt32 *indices, UInt32 numItems,
|
||||||
Int32 includeAltStreams, Int32 replaceAltStreamCharsMode,
|
Int32 includeAltStreams, Int32 replaceAltStreamCharsMode, Int64 soleFolderIndex,
|
||||||
const wchar_t *path, IFolderOperationsExtractCallback *callback)
|
const wchar_t *path, IFolderOperationsExtractCallback *callback)
|
||||||
{
|
{
|
||||||
if (moveMode)
|
if (moveMode)
|
||||||
@@ -44,6 +44,7 @@ STDMETHODIMP CAgentFolder::CopyTo(Int32 moveMode, const UInt32 *indices, UInt32
|
|||||||
|
|
||||||
return Extract(indices, numItems,
|
return Extract(indices, numItems,
|
||||||
includeAltStreams, replaceAltStreamCharsMode,
|
includeAltStreams, replaceAltStreamCharsMode,
|
||||||
|
soleFolderIndex,
|
||||||
pathMode, NExtract::NOverwriteMode::kAsk,
|
pathMode, NExtract::NOverwriteMode::kAsk,
|
||||||
path, BoolToInt(false), extractCallback2);
|
path, BoolToInt(false), extractCallback2);
|
||||||
COM_TRY_END
|
COM_TRY_END
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ IArchiveFolder is used by:
|
|||||||
STDMETHOD(Extract)(const UInt32 *indices, UInt32 numItems, \
|
STDMETHOD(Extract)(const UInt32 *indices, UInt32 numItems, \
|
||||||
Int32 includeAltStreams, \
|
Int32 includeAltStreams, \
|
||||||
Int32 replaceAltStreamCharsMode, \
|
Int32 replaceAltStreamCharsMode, \
|
||||||
|
Int64 soleFolderIndex, \
|
||||||
NExtract::NPathMode::EEnum pathMode, \
|
NExtract::NPathMode::EEnum pathMode, \
|
||||||
NExtract::NOverwriteMode::EEnum overwriteMode, \
|
NExtract::NOverwriteMode::EEnum overwriteMode, \
|
||||||
const wchar_t *path, Int32 testMode, \
|
const wchar_t *path, Int32 testMode, \
|
||||||
|
|||||||
@@ -270,7 +270,8 @@ CArchiveExtractCallback::CArchiveExtractCallback():
|
|||||||
Write_CTime(true),
|
Write_CTime(true),
|
||||||
Write_ATime(true),
|
Write_ATime(true),
|
||||||
Write_MTime(true),
|
Write_MTime(true),
|
||||||
_multiArchives(false)
|
_multiArchives(false),
|
||||||
|
SoleFolderIndex(-1LL)
|
||||||
{
|
{
|
||||||
LocalProgressSpec = new CLocalProgress();
|
LocalProgressSpec = new CLocalProgress();
|
||||||
_localProgress = LocalProgressSpec;
|
_localProgress = LocalProgressSpec;
|
||||||
@@ -371,6 +372,8 @@ void CArchiveExtractCallback::Init(
|
|||||||
NDir::MyGetFullPathName(directoryPath, _dirPathPrefix_Full);
|
NDir::MyGetFullPathName(directoryPath, _dirPathPrefix_Full);
|
||||||
NName::NormalizeDirPathPrefix(_dirPathPrefix_Full);
|
NName::NormalizeDirPathPrefix(_dirPathPrefix_Full);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SoleFolderIndex = -1LL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1125,7 +1128,7 @@ void CArchiveExtractCallback::CreateFolders()
|
|||||||
CDirPathTime pt;
|
CDirPathTime pt;
|
||||||
GetFiTimesCAM(pt);
|
GetFiTimesCAM(pt);
|
||||||
|
|
||||||
if (pt.IsSomeTimeDefined())
|
if (pt.IsSomeTimeDefined() && _index != SoleFolderIndex)
|
||||||
{
|
{
|
||||||
pt.Path = fullPathNew;
|
pt.Path = fullPathNew;
|
||||||
pt.SetDirTime();
|
pt.SetDirTime();
|
||||||
|
|||||||
@@ -460,6 +460,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
_keepAndReplaceEmptyDirPrefixes = keepAndReplaceEmptyDirPrefixes;
|
_keepAndReplaceEmptyDirPrefixes = keepAndReplaceEmptyDirPrefixes;
|
||||||
NumFolders = NumFiles = NumAltStreams = UnpackSize = AltStreams_UnpackSize = 0;
|
NumFolders = NumFiles = NumAltStreams = UnpackSize = AltStreams_UnpackSize = 0;
|
||||||
|
SoleFolderIndex = -1LL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _SFX
|
#ifndef _SFX
|
||||||
|
|||||||
@@ -496,7 +496,7 @@ static void AddPropValueToSum(IFolderFolder *folder, int index, PROPID propID, U
|
|||||||
sum = (UInt64)(Int64)-1;
|
sum = (UInt64)(Int64)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
UString CPanel::GetItemsInfoString(const CRecordVector<UInt32> &indices, int *soleDir)
|
UString CPanel::GetItemsInfoString(const CRecordVector<UInt32> &indices, int *soleDir, Int64 &soleFolderIndex)
|
||||||
{
|
{
|
||||||
UString info;
|
UString info;
|
||||||
UInt64 numDirs, numFiles, filesSize, foldersSize;
|
UInt64 numDirs, numFiles, filesSize, foldersSize;
|
||||||
@@ -511,6 +511,7 @@ UString CPanel::GetItemsInfoString(const CRecordVector<UInt32> &indices, int *so
|
|||||||
{
|
{
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
*soleDir = 1;
|
*soleDir = 1;
|
||||||
|
soleFolderIndex = (Int64)index;
|
||||||
} else {
|
} else {
|
||||||
*soleDir = 0;
|
*soleDir = 0;
|
||||||
}
|
}
|
||||||
@@ -525,6 +526,10 @@ UString CPanel::GetItemsInfoString(const CRecordVector<UInt32> &indices, int *so
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((*soleDir) != 1) {
|
||||||
|
soleFolderIndex = -1LL;
|
||||||
|
}
|
||||||
|
|
||||||
AddValuePair2(info, IDS_PROP_FOLDERS, numDirs, foldersSize);
|
AddValuePair2(info, IDS_PROP_FOLDERS, numDirs, foldersSize);
|
||||||
AddValuePair2(info, IDS_PROP_FILES, numFiles, filesSize);
|
AddValuePair2(info, IDS_PROP_FILES, numFiles, filesSize);
|
||||||
int numDefined = ((foldersSize != (UInt64)(Int64)-1) && foldersSize != 0) ? 1: 0;
|
int numDefined = ((foldersSize != (UInt64)(Int64)-1) && foldersSize != 0) ? 1: 0;
|
||||||
@@ -629,6 +634,8 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
|
|||||||
|
|
||||||
bool useFullItemPaths = srcPanel.Is_IO_FS_Folder(); // maybe we need flat also here ??
|
bool useFullItemPaths = srcPanel.Is_IO_FS_Folder(); // maybe we need flat also here ??
|
||||||
|
|
||||||
|
Int64 soleFolderIndex = -1LL; // initially unset value
|
||||||
|
|
||||||
{
|
{
|
||||||
CCopyDialog copyDialog;
|
CCopyDialog copyDialog;
|
||||||
|
|
||||||
@@ -636,7 +643,7 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
|
|||||||
copyDialog.Value = destPath;
|
copyDialog.Value = destPath;
|
||||||
LangString(move ? IDS_MOVE : IDS_COPY, copyDialog.Title);
|
LangString(move ? IDS_MOVE : IDS_COPY, copyDialog.Title);
|
||||||
LangString(move ? IDS_MOVE_TO : IDS_COPY_TO, copyDialog.Static);
|
LangString(move ? IDS_MOVE_TO : IDS_COPY_TO, copyDialog.Static);
|
||||||
copyDialog.Info = srcPanel.GetItemsInfoString(indices, ©Dialog.soleDir);
|
copyDialog.Info = srcPanel.GetItemsInfoString(indices, ©Dialog.soleDir, soleFolderIndex);
|
||||||
copyDialog.m_currentFolderPrefix = srcPanel._currentFolderPrefix;
|
copyDialog.m_currentFolderPrefix = srcPanel._currentFolderPrefix;
|
||||||
|
|
||||||
if (copyDialog.Create(srcPanel.GetParent()) != IDOK)
|
if (copyDialog.Create(srcPanel.GetParent()) != IDOK)
|
||||||
@@ -815,6 +822,7 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
|
|||||||
options.includeAltStreams = true;
|
options.includeAltStreams = true;
|
||||||
options.replaceAltStreamChars = false;
|
options.replaceAltStreamChars = false;
|
||||||
options.showErrorMessages = true;
|
options.showErrorMessages = true;
|
||||||
|
options.soleFolderIndex = soleFolderIndex;
|
||||||
|
|
||||||
result = srcPanel.CopyTo(options, indices, NULL);
|
result = srcPanel.CopyTo(options, indices, NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -248,6 +248,7 @@ struct CCopyToOptions
|
|||||||
NExtract::NZoneIdMode::EEnum ZoneIdMode;
|
NExtract::NZoneIdMode::EEnum ZoneIdMode;
|
||||||
|
|
||||||
UString folder;
|
UString folder;
|
||||||
|
Int64 soleFolderIndex;
|
||||||
|
|
||||||
UStringVector hashMethods;
|
UStringVector hashMethods;
|
||||||
|
|
||||||
@@ -263,6 +264,7 @@ struct CCopyToOptions
|
|||||||
showErrorMessages(false),
|
showErrorMessages(false),
|
||||||
NeedRegistryZone(true),
|
NeedRegistryZone(true),
|
||||||
ZoneIdMode(NExtract::NZoneIdMode::kNone),
|
ZoneIdMode(NExtract::NZoneIdMode::kNone),
|
||||||
|
soleFolderIndex(-1LL),
|
||||||
VirtFileSystemSpec(NULL),
|
VirtFileSystemSpec(NULL),
|
||||||
VirtFileSystem(NULL)
|
VirtFileSystem(NULL)
|
||||||
{}
|
{}
|
||||||
@@ -886,7 +888,7 @@ public:
|
|||||||
void RefreshTitle(bool always = false) { _panelCallback->RefreshTitle(always); }
|
void RefreshTitle(bool always = false) { _panelCallback->RefreshTitle(always); }
|
||||||
void RefreshTitleAlways() { RefreshTitle(true); }
|
void RefreshTitleAlways() { RefreshTitle(true); }
|
||||||
|
|
||||||
UString GetItemsInfoString(const CRecordVector<UInt32> &indices, int *soleDir);
|
UString GetItemsInfoString(const CRecordVector<UInt32> &indices, int *soleDir, Int64 &soleFolderIndex);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CMyBuffer
|
class CMyBuffer
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ HRESULT CPanelCopyThread::ProcessVirt()
|
|||||||
&Indices.Front(), Indices.Size(),
|
&Indices.Front(), Indices.Size(),
|
||||||
BoolToInt(options->includeAltStreams),
|
BoolToInt(options->includeAltStreams),
|
||||||
BoolToInt(options->replaceAltStreamChars),
|
BoolToInt(options->replaceAltStreamChars),
|
||||||
|
options->soleFolderIndex,
|
||||||
options->folder, ExtractCallback);
|
options->folder, ExtractCallback);
|
||||||
|
|
||||||
if (result2 == S_OK && !ExtractCallbackSpec->ThereAreMessageErrors)
|
if (result2 == S_OK && !ExtractCallbackSpec->ThereAreMessageErrors)
|
||||||
|
|||||||
@@ -183,6 +183,7 @@ public:
|
|||||||
CPanel *Panel;
|
CPanel *Panel;
|
||||||
CRecordVector<UInt32> Indices;
|
CRecordVector<UInt32> Indices;
|
||||||
UString Folder;
|
UString Folder;
|
||||||
|
Int64 SoleFolderIndex;
|
||||||
CDataObject *DataObjectSpec;
|
CDataObject *DataObjectSpec;
|
||||||
CMyComPtr<IDataObject> DataObject;
|
CMyComPtr<IDataObject> DataObject;
|
||||||
|
|
||||||
@@ -351,6 +352,7 @@ void CPanel::OnDrag(LPNMLISTVIEW /* nmListView */)
|
|||||||
CDataObject *dataObjectSpec = new CDataObject;
|
CDataObject *dataObjectSpec = new CDataObject;
|
||||||
CMyComPtr<IDataObject> dataObject = dataObjectSpec;
|
CMyComPtr<IDataObject> dataObject = dataObjectSpec;
|
||||||
|
|
||||||
|
Int64 soleFolderIndex = -1LL; // initially unset value
|
||||||
{
|
{
|
||||||
UStringVector names;
|
UStringVector names;
|
||||||
|
|
||||||
@@ -366,6 +368,15 @@ void CPanel::OnDrag(LPNMLISTVIEW /* nmListView */)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
s = GetItemName(index);
|
s = GetItemName(index);
|
||||||
|
if (IsItem_Folder(index)) {
|
||||||
|
if (i == 0) {
|
||||||
|
soleFolderIndex = (Int64)index;
|
||||||
|
} else {
|
||||||
|
soleFolderIndex = -1LL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
soleFolderIndex = -1LL;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
// We use (keepAndReplaceEmptyPrefixes = true) in CAgentFolder::Extract
|
// We use (keepAndReplaceEmptyPrefixes = true) in CAgentFolder::Extract
|
||||||
// So the following code is not required.
|
// So the following code is not required.
|
||||||
@@ -397,6 +408,7 @@ void CPanel::OnDrag(LPNMLISTVIEW /* nmListView */)
|
|||||||
dropSourceSpec->Panel = this;
|
dropSourceSpec->Panel = this;
|
||||||
dropSourceSpec->Indices = indices;
|
dropSourceSpec->Indices = indices;
|
||||||
dropSourceSpec->Folder = fs2us(dirPrefix);
|
dropSourceSpec->Folder = fs2us(dirPrefix);
|
||||||
|
dropSourceSpec->SoleFolderIndex = soleFolderIndex;
|
||||||
dropSourceSpec->DataObjectSpec = dataObjectSpec;
|
dropSourceSpec->DataObjectSpec = dataObjectSpec;
|
||||||
dropSourceSpec->DataObject = dataObjectSpec;
|
dropSourceSpec->DataObject = dataObjectSpec;
|
||||||
|
|
||||||
@@ -482,6 +494,7 @@ void CPanel::OnDrag(LPNMLISTVIEW /* nmListView */)
|
|||||||
options.folder = dataObjectSpec->Path;
|
options.folder = dataObjectSpec->Path;
|
||||||
// if MOVE is not allowed, we just use COPY operation
|
// if MOVE is not allowed, we just use COPY operation
|
||||||
options.moveMode = (effect == DROPEFFECT_MOVE && moveIsAllowed);
|
options.moveMode = (effect == DROPEFFECT_MOVE && moveIsAllowed);
|
||||||
|
options.soleFolderIndex = soleFolderIndex;
|
||||||
res = CopyTo(options, indices, &dropSourceSpec->Messages);
|
res = CopyTo(options, indices, &dropSourceSpec->Messages);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user