OSDN Git Service

PATCH: [ 1151949 ] Fix CDirDoc::FindItemFromPaths for root
authorPerry Rapp <elsapo@users.sourceforge.net>
Sat, 26 Feb 2005 06:49:41 +0000 (06:49 +0000)
committerPerry Rapp <elsapo@users.sourceforge.net>
Sat, 26 Feb 2005 06:49:41 +0000 (06:49 +0000)
Src/DirDoc.cpp
Src/readme.txt

index 9e71f39..1ae33ba 100644 (file)
@@ -408,14 +408,21 @@ POSITION CDirDoc::FindItemFromPaths(LPCTSTR pathLeft, LPCTSTR pathRight)
        CString path2, file2;
        SplitFilename(pathRight, &path2, &file2, 0);
 
+       // Filenames must be identical
+       if (file1 != file2)
+               return NULL;
+
        // Path can contain (because of difftools?) '/' and '\'
        // so for comparing purposes, convert whole path to use '\\'
        path1.Replace('/', '\\');
        path2.Replace('/', '\\');
 
-       // Filenames must be identical
-       if (file1 != file2)
-               return NULL;
+
+       // Add trailing slash to root paths, to work with getLeftFilepath etc
+       if (path1.GetLength() == 2 && path1[1] == ':')
+               path1 += '\\';
+       if (path2.GetLength() == 2 && path2[1] == ':')
+               path2 += '\\';
 
        // Get first item
        DIFFITEM current = m_pCtxt->GetDiffAt(pos);
index 47db7d6..ed57e21 100644 (file)
@@ -1,3 +1,7 @@
+2005-02-26 Perry
+ PATCH: [ 1151949 ] Fix CDirDoc::FindItemFromPaths for root
+  Src: DirDoc.cpp
+
 2005-02-23 Perry
  PATCH: [ 1145016 ] i18n the version control strings
   Src: Merge.rc PropVss.cpp PropVss.h resource.h