OSDN Git Service

Make an archive file comparable to a normal file
authorsdottaka <sdottaka@users.sourceforge.net>
Sat, 20 Jun 2015 03:25:58 +0000 (12:25 +0900)
committersdottaka <sdottaka@users.sourceforge.net>
Sat, 20 Jun 2015 03:25:58 +0000 (12:25 +0900)
--HG--
branch : stable

Src/MainFrm.cpp
Src/paths.cpp

index 9cf3073..3669068 100644 (file)
@@ -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);
index 2fe10f1..3399f9f 100644 (file)
@@ -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;
 }