#include "MainFrm.h"
#include "coretools.h"
#include "OutputDlg.h"
+#include "paths.h"
#ifdef _DEBUG
#define new DEBUG_NEW
CString name, pathex;
name = m_pList->GetItemText(sel, DV_NAME);
pathex = m_pList->GetItemText(sel, DV_PATH);
+ strLeft = pd->m_pCtxt->m_strLeft;
+ strRight = pd->m_pCtxt->m_strRight;
if (pathex.Left(2) == _T(".\\") || pathex.Left(2) == _T("./"))
{
- strLeft.Format(_T("%s\\%s\\%s"), pd->m_pCtxt->m_strLeft, pathex.Right(pathex.GetLength()-2), name);
- strRight.Format(_T("%s\\%s\\%s"), pd->m_pCtxt->m_strRight, pathex.Right(pathex.GetLength()-2), name);
- }
- else
- {
- strLeft.Format(_T("%s\\%s"), pd->m_pCtxt->m_strLeft, name);
- strRight.Format(_T("%s\\%s"), pd->m_pCtxt->m_strRight, name);
+ strLeft = paths_ConcatPath(strLeft, pathex.Right(pathex.GetLength()-2));
+ strRight = paths_ConcatPath(strRight, pathex.Right(pathex.GetLength()-2));
}
+ strLeft = paths_ConcatPath(strLeft, name);
+ strRight = paths_ConcatPath(strRight, name);
}
// Open selected file on specified side
case FILE_DIFF:
{
CString left, right;
- if (GetSelectedFileNames(left, right))
- mf->ShowMergeDoc(GetDocument(), left, right);
+ GetItemFileNames(sel, left, right);
+ mf->ShowMergeDoc(GetDocument(), left, right);
}
break;
case FILE_SAME:
// if this fails, outFile == ""
return outFile;
}
+
+// Append subpath to path
+// Skip empty arguments
+// Ensure exactly one backslash between them in result
+CString paths_ConcatPath(const CString & path, const CString & subpath)
+{
+ if (path.IsEmpty()) return subpath;
+ if (subpath.IsEmpty()) return path;
+ if (EndsWithSlash(path))
+ {
+ if (IsSlash(subpath[0]))
+ {
+ return path + subpath.Mid(1);
+ }
+ else
+ {
+ return path + subpath;
+ }
+ }
+ else
+ {
+ if (IsSlash(subpath[0]))
+ {
+ return path + subpath;
+ }
+ else
+ {
+ return path + _T("\\") + subpath;
+ }
+ }
+}
TCHAR paths_GetCurrentDriveUpper();
PATH_EXISTENCE GetPairComparability(LPCTSTR pszLeft, LPCTSTR pszRight);
CString ExpandShortcut(CString &inFile);
+CString paths_ConcatPath(const CString & path, const CString & subpath);
#endif // paths_h_included
+2003-03-31 Perry
+ PATCH: [ 712429 ] Fix UpdateItemStatus bug 712093
+ WinMerge: DirActions.cpp DirView.cpp paths.cpp paths.h
+
2003-03-30 Perry
PATCH: [ 712417 ] Fix save of open doc before next merge
WinMerge: ChildFrm.cpp ChildFrm.h DirDoc.cpp DirDoc.h DirFrame.cpp DirFrame.h