From 5da24c91c8038615b135357a01dc8b6adc00ee62 Mon Sep 17 00:00:00 2001 From: sdottaka Date: Sat, 20 Jun 2015 12:25:58 +0900 Subject: [PATCH] Make an archive file comparable to a normal file --HG-- branch : stable --- Src/MainFrm.cpp | 15 ++++++++++----- Src/paths.cpp | 16 ++++++++++++++-- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/Src/MainFrm.cpp b/Src/MainFrm.cpp index 9cf307373..3669068e5 100644 --- a/Src/MainFrm.cpp +++ b/Src/MainFrm.cpp @@ -978,11 +978,16 @@ BOOL CMainFrame::DoFileOpen(const PathContext * pFiles /*=NULL*/, } } - DecompressResult res = DecompressArchive(m_hWnd, files); - if (res.pTempPathContext) + CTempPathContext *pTempPathContext = NULL; + if (pathsType == IS_EXISTING_DIR) { - pathsType = res.pathsType; - files = res.files; + DecompressResult res= DecompressArchive(m_hWnd, files); + if (res.pTempPathContext) + { + pathsType = res.pathsType; + files = res.files; + pTempPathContext = res.pTempPathContext; + } } // Determine if we want new a dirview open now that we know if it was @@ -1013,7 +1018,7 @@ BOOL CMainFrame::DoFileOpen(const PathContext * pFiles /*=NULL*/, } // Anything that can go wrong inside InitCompare() will yield an // exception. There is no point in checking return value. - pDirDoc->InitCompare(files, bRecurse, res.pTempPathContext); + pDirDoc->InitCompare(files, bRecurse, pTempPathContext); pDirDoc->SetDescriptions(theApp.m_strDescriptions); pDirDoc->SetTitle(NULL); diff --git a/Src/paths.cpp b/Src/paths.cpp index 2fe10f1de..3399f9fff 100644 --- a/Src/paths.cpp +++ b/Src/paths.cpp @@ -389,10 +389,22 @@ PATH_EXISTENCE GetPairComparability(const PathContext & paths, bool (*IsArchiveF return DOES_NOT_EXIST; PATH_EXISTENCE p2 = paths_DoesPathExist(paths[1], IsArchiveFile); if (p1 != p2) - return DOES_NOT_EXIST; + { + p1 = paths_DoesPathExist(paths[0]); + p2 = paths_DoesPathExist(paths[1]); + if (p1 != p2) + return DOES_NOT_EXIST; + } if (paths.GetSize() < 3) return p1; PATH_EXISTENCE p3 = paths_DoesPathExist(paths[2], IsArchiveFile); - if (p2 != p3) return DOES_NOT_EXIST; + if (p2 != p3) + { + p1 = paths_DoesPathExist(paths[0]); + p2 = paths_DoesPathExist(paths[1]); + p3 = paths_DoesPathExist(paths[2]); + if (p1 != p2 || p2 != p3) + return DOES_NOT_EXIST; + } return p1; } -- 2.11.0