feat: opens sole folder instead of upper folder after extraction; cancel folder priority over file in comparison; other minor ui fix

This commit is contained in:
shunf4
2024-05-11 15:59:23 +08:00
parent 0e3812de49
commit 91f7e0cc57
10 changed files with 153 additions and 27 deletions

View File

@@ -358,6 +358,11 @@ HRESULT CApp::Create(HWND hwnd, const UString &mainPath, const UString &arcForma
SetFocusedPanel(LastFocusedPanel);
Panels[LastFocusedPanel].SetFocusToList();
if (pDelayedOpenFolderAfterExtractPathCriticalSection == NULL) {
pDelayedOpenFolderAfterExtractPathCriticalSection = new NWindows::NSynchronization::CCriticalSection();
}
return S_OK;
}
@@ -409,6 +414,10 @@ void CApp::Save()
void CApp::Release()
{
if (pDelayedOpenFolderAfterExtractPathCriticalSection != NULL) {
delete pDelayedOpenFolderAfterExtractPathCriticalSection;
pDelayedOpenFolderAfterExtractPathCriticalSection = NULL;
}
// It's for unloading COM dll's: don't change it.
for (unsigned i = 0; i < kNumPanelsMax; i++)
Panels[i].Release();
@@ -885,9 +894,49 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
if (!g_bProcessError && result == S_OK)
{
if (openOutputFolder && IsDirectory(destPath))
if (openOutputFolder)
{
StartApplicationDontWait(destPath, destPath, (HWND)_window);
bool done = false;
if (!done && soleFolderIndex != -1LL) {
UString soleFolderName = srcPanel.GetItemRelPath((UInt32)soleFolderIndex);
if (soleFolderName.Len() > 0 && (soleFolderName[0] == L'\\' || soleFolderName[0] == L'/' || soleFolderName[0] == '\\' || soleFolderName[0] == '/')) {
soleFolderName = soleFolderName.Mid(1, soleFolderName.Len() - 1);
}
if (soleFolderName.Len() > 0 && (soleFolderName.Back() == L'\\' || soleFolderName.Back() == L'/' || soleFolderName.Back() == '\\' || soleFolderName.Back() == '/')) {
soleFolderName.DeleteBack();
}
UString destPathWithSoleFolder = destPath;
destPathWithSoleFolder += L'\\';
destPathWithSoleFolder += soleFolderName;
if (IsDirectory(destPathWithSoleFolder)) {
done = true;
if (close7Zip)
{
StartApplicationDontWait(destPathWithSoleFolder, destPathWithSoleFolder, (HWND)_window);
} else {
{
NWindows::NSynchronization::CCriticalSectionLock lock(*pDelayedOpenFolderAfterExtractPathCriticalSection);
DelayedOpenFolderAfterExtractPath = destPathWithSoleFolder;
}
_window.SetTimer(1678, 800);
}
}
}
if (!done) {
if (IsDirectory(destPath)) {
if (close7Zip)
{
StartApplicationDontWait(destPath, destPath, (HWND)_window);
} else {
{
NWindows::NSynchronization::CCriticalSectionLock lock(*pDelayedOpenFolderAfterExtractPathCriticalSection);
DelayedOpenFolderAfterExtractPath = destPath;
}
_window.SetTimer(1678, 800);
}
}
}
}
if (deleteSourceFile)
{