feat: do not set time for sole folder in extraction

This commit is contained in:
shunf4
2024-05-10 15:52:53 +08:00
parent 6b37ada7a3
commit b42e86bdcf
9 changed files with 39 additions and 6 deletions

View File

@@ -496,7 +496,7 @@ static void AddPropValueToSum(IFolderFolder *folder, int index, PROPID propID, U
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;
UInt64 numDirs, numFiles, filesSize, foldersSize;
@@ -511,6 +511,7 @@ UString CPanel::GetItemsInfoString(const CRecordVector<UInt32> &indices, int *so
{
if (i == 0) {
*soleDir = 1;
soleFolderIndex = (Int64)index;
} else {
*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_FILES, numFiles, filesSize);
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 ??
Int64 soleFolderIndex = -1LL; // initially unset value
{
CCopyDialog copyDialog;
@@ -636,7 +643,7 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
copyDialog.Value = destPath;
LangString(move ? IDS_MOVE : IDS_COPY, copyDialog.Title);
LangString(move ? IDS_MOVE_TO : IDS_COPY_TO, copyDialog.Static);
copyDialog.Info = srcPanel.GetItemsInfoString(indices, &copyDialog.soleDir);
copyDialog.Info = srcPanel.GetItemsInfoString(indices, &copyDialog.soleDir, soleFolderIndex);
copyDialog.m_currentFolderPrefix = srcPanel._currentFolderPrefix;
if (copyDialog.Create(srcPanel.GetParent()) != IDOK)
@@ -815,6 +822,7 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
options.includeAltStreams = true;
options.replaceAltStreamChars = false;
options.showErrorMessages = true;
options.soleFolderIndex = soleFolderIndex;
result = srcPanel.CopyTo(options, indices, NULL);
}

View File

@@ -248,6 +248,7 @@ struct CCopyToOptions
NExtract::NZoneIdMode::EEnum ZoneIdMode;
UString folder;
Int64 soleFolderIndex;
UStringVector hashMethods;
@@ -263,6 +264,7 @@ struct CCopyToOptions
showErrorMessages(false),
NeedRegistryZone(true),
ZoneIdMode(NExtract::NZoneIdMode::kNone),
soleFolderIndex(-1LL),
VirtFileSystemSpec(NULL),
VirtFileSystem(NULL)
{}
@@ -886,7 +888,7 @@ public:
void RefreshTitle(bool always = false) { _panelCallback->RefreshTitle(always); }
void RefreshTitleAlways() { RefreshTitle(true); }
UString GetItemsInfoString(const CRecordVector<UInt32> &indices, int *soleDir);
UString GetItemsInfoString(const CRecordVector<UInt32> &indices, int *soleDir, Int64 &soleFolderIndex);
};
class CMyBuffer

View File

@@ -104,6 +104,7 @@ HRESULT CPanelCopyThread::ProcessVirt()
&Indices.Front(), Indices.Size(),
BoolToInt(options->includeAltStreams),
BoolToInt(options->replaceAltStreamChars),
options->soleFolderIndex,
options->folder, ExtractCallback);
if (result2 == S_OK && !ExtractCallbackSpec->ThereAreMessageErrors)

View File

@@ -183,6 +183,7 @@ public:
CPanel *Panel;
CRecordVector<UInt32> Indices;
UString Folder;
Int64 SoleFolderIndex;
CDataObject *DataObjectSpec;
CMyComPtr<IDataObject> DataObject;
@@ -351,6 +352,7 @@ void CPanel::OnDrag(LPNMLISTVIEW /* nmListView */)
CDataObject *dataObjectSpec = new CDataObject;
CMyComPtr<IDataObject> dataObject = dataObjectSpec;
Int64 soleFolderIndex = -1LL; // initially unset value
{
UStringVector names;
@@ -366,6 +368,15 @@ void CPanel::OnDrag(LPNMLISTVIEW /* nmListView */)
else
{
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
// So the following code is not required.
@@ -397,6 +408,7 @@ void CPanel::OnDrag(LPNMLISTVIEW /* nmListView */)
dropSourceSpec->Panel = this;
dropSourceSpec->Indices = indices;
dropSourceSpec->Folder = fs2us(dirPrefix);
dropSourceSpec->SoleFolderIndex = soleFolderIndex;
dropSourceSpec->DataObjectSpec = dataObjectSpec;
dropSourceSpec->DataObject = dataObjectSpec;
@@ -482,6 +494,7 @@ void CPanel::OnDrag(LPNMLISTVIEW /* nmListView */)
options.folder = dataObjectSpec->Path;
// if MOVE is not allowed, we just use COPY operation
options.moveMode = (effect == DROPEFFECT_MOVE && moveIsAllowed);
options.soleFolderIndex = soleFolderIndex;
res = CopyTo(options, indices, &dropSourceSpec->Messages);
}
/*