2005-12-17 Perry
PATCH: [ 1382955 ] Remove unused CompareStats.h include from DirFrame.cpp
Src: DirFrame.cpp
+ PATCH: [ 1376711 ] Change CFile::GetStatus to paths_DoesPathExist
+ Src: files.cpp MainFrm.cpp MainFrm.h Merge.cpp MergeDoc.cpp OpenDlg.cpp
+ PathContext.cpp
+ Src/Common: coretools.cpp
2005-12-16 Kimmo
PATCH: [ 1381984 ] Folder compare progressdialog could be drawn off-screen
// RCS ID line follows -- this is updated by CVS
// $Id$
#include "stdafx.h"
-#ifndef __AFXDISP_H__
-#include <afxdisp.h>
-#endif // __AFXDISP_H__
#include <stdio.h>
#include <io.h>
#include <mbctype.h> // MBCS (multibyte codepage stuff)
CString spath = GetModulePath() + _T("\\Copying");
CString url = _T("http://www.gnu.org/copyleft/gpl.html");
- CFileStatus status;
- if (CFile::GetStatus(spath, status))
- ShellExecute(m_hWnd, _T("open"), _T("notepad.exe"), spath, NULL, SW_SHOWNORMAL);
- else
- ShellExecute(NULL, _T("open"), url, NULL, NULL, SW_SHOWNORMAL);
+ OpenFileOrUrl(spath, url);
}
/**
BOOL CMainFrame::CreateBackup(LPCTSTR pszPath)
{
// first, make a backup copy of the original
- CFileStatus status;
-
// create backup copy of file if destination file exists
- if (m_options.GetBool(OPT_CREATE_BACKUPS) && CFile::GetStatus(pszPath, status))
+ if (m_options.GetBool(OPT_CREATE_BACKUPS)
+ && paths_DoesPathExist(pszPath) == IS_EXISTING_FILE)
{
// Add backup extension if pathlength allows it
BOOL success = TRUE;
return FALSE;
}
+/**
+ * @brief Open file, if it exists, else open url
+ */
+void CMainFrame::OpenFileOrUrl(LPCTSTR szFile, LPCTSTR szUrl)
+{
+ if (paths_DoesPathExist(szFile) == IS_EXISTING_FILE)
+ ShellExecute(m_hWnd, _T("open"), _T("notepad.exe"), szFile, NULL, SW_SHOWNORMAL);
+ else
+ ShellExecute(NULL, _T("open"), szUrl, NULL, NULL, SW_SHOWNORMAL);
+}
+
void CMainFrame::OnHelpContents()
{
CString spath = GetModulePath(0) + DocsPath;
- CFileStatus status;
- if (CFile::GetStatus(spath, status))
- ShellExecute(NULL, _T("open"), spath, NULL, NULL, SW_SHOWNORMAL);
- else
- ShellExecute(NULL, _T("open"), DocsURL, NULL, NULL, SW_SHOWNORMAL);
-
+ OpenFileOrUrl(spath, DocsURL);
}
void CMainFrame::OnUpdateHelpContents(CCmdUI* pCmdUI)
CDirDoc * GetDirDocToShow(BOOL * pNew);
void ShowFontChangeMessage();
void OptionsInit();
+ void OpenFileOrUrl(LPCTSTR szFile, LPCTSTR szUrl);
};
extern CMainFrame *mf;
// check if specified path is a file
if (root_path!=NULL)
{
- CFileStatus status;
- if (CFile::GetStatus(root_path,status)
- && (status.m_attribute!=CFile::Attribute::directory))
+ if (paths_DoesPathExist(root_path) == IS_EXISTING_FILE)
{
SplitFilename(root_path, 0, &sfile, 0);
}
CString docPath = defPath + _T("\\contributors.txt");
HINSTANCE ret = 0;
- CFileStatus status;
- if (CFile::GetStatus(docPath, status))
+ if (paths_DoesPathExist(docPath) == IS_EXISTING_FILE)
{
// Now, add quotation marks so ShellExecute() doesn't fail if path
// includes spaces
#include "sbuffer.h"
#include "dllver.h"
#include "codepage.h"
+#include "paths.h"
#ifdef _DEBUG
#define new DEBUG_NEW
// Check third arg possibly given from command-line
if (!mf->m_strSaveAsPath.IsEmpty())
{
- CFileStatus status;
- if (CFile::GetStatus(mf->m_strSaveAsPath, status)
- && (status.m_attribute & CFile::Attribute::directory))
+ if (paths_DoesPathExist(mf->m_strSaveAsPath) == IS_EXISTING_DIR)
{
// third arg was a directory, so get append the filename
CString sname;
CString s;
CString sfolder, sext;
CString dirSelTag;
- CFileStatus status;
UpdateData(TRUE);
+
VERIFY(dirSelTag.LoadString(IDS_DIRSEL_TAG));
- if (CFile::GetStatus(m_strLeft, status)
- && (status.m_attribute & CFile::Attribute::directory))
- sfolder = m_strLeft;
+ if (paths_DoesPathExist(m_strLeft) == IS_EXISTING_DIR)
+ sfolder = m_strLeft;
else
sfolder = GetPathOnly(m_strLeft);
if (SelectFile(s, sfolder))
CString s;
CString sfolder, sext;
CString dirSelTag;
- CFileStatus status;
UpdateData(TRUE);
VERIFY(dirSelTag.LoadString(IDS_DIRSEL_TAG));
- if (CFile::GetStatus(m_strRight, status)
- && (status.m_attribute & CFile::Attribute::directory))
- sfolder = m_strRight;
+ if (paths_DoesPathExist(m_strRight) == IS_EXISTING_DIR)
+ sfolder = m_strRight;
else
sfolder = GetPathOnly(m_strRight);
if (SelectFile(s, sfolder))
*/
BOOL TempFileContext::FilesExist()
{
- CFileStatus s1,s2;
BOOL bLeftExists = FALSE;
BOOL bRightExists = FALSE;
if (!GetLeft().IsEmpty())
- bLeftExists = CFile::GetStatus(GetLeft(), s1);
+ bLeftExists = (paths_DoesPathExist(GetLeft()) == IS_EXISTING_FILE);
if (!GetRight().IsEmpty())
- bRightExists = CFile::GetStatus(GetRight(), s2);
+ bLeftExists = (paths_DoesPathExist(GetRight()) == IS_EXISTING_FILE);
return bLeftExists || bRightExists;
-
}
/**