Index: src/ch/FolderDialog.cpp =================================================================== diff -u -r633a533cb6e741d44fe28aa56339e1d2709b1b27 -r8422e5787e56453d78c7270066c3e8d1743ca757 --- src/ch/FolderDialog.cpp (.../FolderDialog.cpp) (revision 633a533cb6e741d44fe28aa56339e1d2709b1b27) +++ src/ch/FolderDialog.cpp (.../FolderDialog.cpp) (revision 8422e5787e56453d78c7270066c3e8d1743ca757) @@ -25,6 +25,7 @@ #include "shlobj.h" #include "StringHelpers.h" #include "FileSupport.h" +#include "TRecentPathsTools.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -545,21 +546,15 @@ if (m_strPath.Right(1) == _T('\\') || m_strPath.Right(1) == _T('/')) m_strPath=m_strPath.Left(m_strPath.GetLength()-1); - // does it exist as a folder ? -/* CFileFind fnd; - BOOL bExist=fnd.FindFile(m_strPath+_T("\\*")); - fnd.Close();*/ -// WIN32_FIND_DATA wfd; -// HANDLE hFind; - -// if (!bExist) if ( GetFileAttributes(m_strPath) == INVALID_FILE_ATTRIBUTES) { MsgBox(IDS_BDPATHDOESNTEXIST_STRING, MB_OK | MB_ICONERROR); return; } - m_bdData.cvRecent.insert(m_bdData.cvRecent.begin(), (m_strPath + _T('\\'))); + // add to the recent paths + CString strNewPath = m_strPath + _T('\\'); + TRecentPathsTools::AddNewPath(m_bdData.cvRecent, strNewPath); CRect rcDlg; GetWindowRect(&rcDlg); Index: src/ch/MainWnd.cpp =================================================================== diff -u -r458af7bf8c35950fdeb4b906950437596324aea1 -r8422e5787e56453d78c7270066c3e8d1743ca757 --- src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision 458af7bf8c35950fdeb4b906950437596324aea1) +++ src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision 8422e5787e56453d78c7270066c3e8d1743ca757) @@ -42,6 +42,7 @@ #include "../libicpf/exception.h" #include "../libchcore/TTaskManagerStatsSnapshot.h" #include "../libchcore/TSQLiteSerializerFactory.h" +#include "TRecentPathsTools.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -468,7 +469,7 @@ else if(iModalResult == -1) // windows has been closed by a parent return TRUE; - dlg.m_vRecent.push_back(dlg.m_tTaskDefinition.GetDestinationPath().ToString()); + TRecentPathsTools::AddNewPath(dlg.m_vRecent, dlg.m_tTaskDefinition.GetDestinationPath().ToString()); SetPropValue(rConfig, dlg.m_vRecent); @@ -579,7 +580,7 @@ if(dlg.DoModal() == IDOK) { - dlg.m_vRecent.push_back(dlg.m_tTaskDefinition.GetDestinationPath().ToString()); + TRecentPathsTools::AddNewPath(dlg.m_vRecent, dlg.m_tTaskDefinition.GetDestinationPath().ToString()); SetPropValue(rConfig, dlg.m_vRecent); Index: src/ch/TRecentPathsTools.cpp =================================================================== diff -u --- src/ch/TRecentPathsTools.cpp (revision 0) +++ src/ch/TRecentPathsTools.cpp (revision 8422e5787e56453d78c7270066c3e8d1743ca757) @@ -0,0 +1,39 @@ +// ============================================================================ +// Copyright (C) 2001-2014 by Jozef Starosczyk +// ixen@copyhandler.com +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU Library General Public License +// (version 2) as published by the Free Software Foundation; +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// ============================================================================ +#include "stdafx.h" +#include "TRecentPathsTools.h" + +void TRecentPathsTools::AddNewPath(std::vector& vPaths, const CString& strPath) +{ + // find existing path + std::vector::iterator iter = vPaths.begin(); + while(iter != vPaths.end()) + { + if(iter->CompareNoCase(strPath) == 0) + { + // get rid of the existing item (we need it to be at the beginning of this list) + iter = vPaths.erase(iter); + } + else + ++iter; + } + + vPaths.insert(vPaths.begin(), strPath); +} + Index: src/ch/TRecentPathsTools.h =================================================================== diff -u --- src/ch/TRecentPathsTools.h (revision 0) +++ src/ch/TRecentPathsTools.h (revision 8422e5787e56453d78c7270066c3e8d1743ca757) @@ -0,0 +1,28 @@ +// ============================================================================ +// Copyright (C) 2001-2014 by Jozef Starosczyk +// ixen@copyhandler.com +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU Library General Public License +// (version 2) as published by the Free Software Foundation; +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// ============================================================================ +#ifndef __RECENTPATHSTOOLS_H__ +#define __RECENTPATHSTOOLS_H__ + +class TRecentPathsTools +{ +public: + static void AddNewPath(std::vector& vPaths, const CString& strPath); +}; + +#endif Index: src/ch/ch.vc90.vcproj =================================================================== diff -u -r5b00f9d15e8f63e939fe9e346902f1a99e38b99e -r8422e5787e56453d78c7270066c3e8d1743ca757 --- src/ch/ch.vc90.vcproj (.../ch.vc90.vcproj) (revision 5b00f9d15e8f63e939fe9e346902f1a99e38b99e) +++ src/ch/ch.vc90.vcproj (.../ch.vc90.vcproj) (revision 8422e5787e56453d78c7270066c3e8d1743ca757) @@ -835,6 +835,14 @@ > + + + +