OSDN Git Service

PATCH: [ 1189718 ] OpenDlg: add trailing slash to directory names
authorKimmo Varis <kimmov@gmail.com>
Tue, 26 Apr 2005 15:29:23 +0000 (15:29 +0000)
committerKimmo Varis <kimmov@gmail.com>
Tue, 26 Apr 2005 15:29:23 +0000 (15:29 +0000)
Src/OpenDlg.cpp
Src/paths.cpp
Src/paths.h
Src/readme.txt

index 2410f94..2bf02e8 100644 (file)
@@ -188,6 +188,15 @@ void COpenDlg::OnOK()
        m_strRight = paths_GetLongPath(m_strRight);
        m_strLeft = paths_GetLongPath(m_strLeft);
 
+       // Add trailing '\' for directories if its missing
+       if (m_pathsType == IS_EXISTING_DIR)
+       {
+               if (!paths_EndsWithSlash(m_strLeft))
+                       m_strLeft += '\\';
+               if (!paths_EndsWithSlash(m_strRight))
+                       m_strRight += '\\';
+       }
+
        UpdateData(FALSE);
        KillTimer(IDT_CHECKFILES);
 
index e55b433..9486c50 100644 (file)
@@ -22,7 +22,7 @@ bool IsSlash(LPCTSTR pszStart, int nPos)
 #endif
 }
 
-bool EndsWithSlash(const CString & s)
+bool paths_EndsWithSlash(const CString & s)
 {
        return !s.IsEmpty() && IsSlash(s, s.GetLength()-1);
 }
@@ -68,7 +68,7 @@ void paths_normalize(CString & sPath)
                return;
 
        // remove any trailing slash
-       if (EndsWithSlash(sPath))
+       if (paths_EndsWithSlash(sPath))
                sPath.Delete(sPath.GetLength()-1);
 }
 
@@ -352,7 +352,7 @@ CString paths_ConcatPath(const CString & path, const CString & subpath)
 {
        if (path.IsEmpty()) return subpath;
        if (subpath.IsEmpty()) return path;
-       if (EndsWithSlash(path))
+       if (paths_EndsWithSlash(path))
        {
                if (IsSlash(subpath, 0))
                {
index 16e7b3c..036fad8 100644 (file)
@@ -12,6 +12,7 @@
 typedef enum { DOES_NOT_EXIST, IS_EXISTING_FILE, IS_EXISTING_DIR } PATH_EXISTENCE;
 typedef enum { DIRSLASH, NODIRSLASH } DIRSLASH_TYPE;
 
+bool paths_EndsWithSlash(const CString & s);
 PATH_EXISTENCE paths_DoesPathExist(LPCTSTR szPath);
 void paths_normalize(CString & sPath);
 CString paths_GetLongPath(const CString & sPath);
index 433fd5d..91c616f 100644 (file)
@@ -1,6 +1,8 @@
 2005-04-26 Kimmo
  PATCH: [ 1189875 ] Small cleanup for line replace code
   Src: MergeDoc.cpp
+ PATCH: [ 1189718 ] OpenDlg: add trailing slash to directory names
+  Src: OpenDlg.cpp paths.cpp paths.h
 
 2005-04-25 Kimmo
  BUG: [ 1179790 ] ReadMe-Hungarian.rtf file is missing