OSDN Git Service

PATCH: [ 1483344 ] Fix creating private file filters
authorKimmo Varis <kimmov@gmail.com>
Mon, 8 May 2006 15:17:12 +0000 (15:17 +0000)
committerKimmo Varis <kimmov@gmail.com>
Mon, 8 May 2006 15:17:12 +0000 (15:17 +0000)
Src/Changes.txt
Src/FileFiltersDlg.cpp

index b1a2a78..46ac47c 100644 (file)
@@ -2,6 +2,10 @@ Src\Changes.txt
 Add new items to top.
 (This summarizes all changes to all files under Src, including Src\Languages.)
 
+2006-05-08 Kimmo
+ PATCH: [ 1483344 ] Fix creating private file filters
+  Src: FileFiltersDlg.cpp
+
 2006-05-07 Kimmo
  PATCH: [ 1483107 ] Remove dublicated code from folder compare progress dlg
   Src: DirCompProgressDlg.cpp DirCompProgressDlg.h
index bbd5d18..57975fe 100644 (file)
@@ -394,6 +394,7 @@ void FileFiltersDlg::OnBnClickedFilterfileTestButton()
  * filter directories?
  * @todo Warn user instead of silently failing when there
  * are no defined filter folders.
+ * @bug Doesn't fail or inform if copying template file fails.
  */
 void FileFiltersDlg::OnBnClickedFilterfileNewbutton()
 {
@@ -409,6 +410,11 @@ void FileFiltersDlg::OnBnClickedFilterfileNewbutton()
                return;
        }
 
+       CString templatePath(globalPath);
+       if (templatePath[templatePath.GetLength()-1] != '\\')
+               templatePath += "\\";
+       templatePath += FILE_FILTER_TEMPLATE;
+
        CString path = (globalPath.IsEmpty() ? userPath : globalPath);
 
        if (!globalPath.IsEmpty() && !userPath.IsEmpty())
@@ -420,8 +426,6 @@ void FileFiltersDlg::OnBnClickedFilterfileNewbutton()
        if (path.GetLength() && path[path.GetLength()-1] != '\\')
                path += '\\';
        
-       CString tmplPath = path + FILE_FILTER_TEMPLATE;
-       
        CString s;
        if (SelectFile(s, path, title, IDS_FILEFILTER_FILEMASK, FALSE))
        {
@@ -443,7 +447,7 @@ void FileFiltersDlg::OnBnClickedFilterfileNewbutton()
                        s += FileFilterExt;
                }
 
-               CopyFile(tmplPath, s, TRUE);
+               CopyFile(templatePath, s, TRUE);
                theApp.m_globalFileFilter.EditFileFilter(s);
                FileFilterMgr *pMgr = theApp.m_globalFileFilter.GetManager();
                pMgr->AddFilter(s);