// TortoiseMerge - a Diff/Patch program\r
\r
-// Copyright (C) 2006-2008 - TortoiseSVN\r
+// Copyright (C) 2006-2009 - TortoiseSVN\r
\r
// This program is free software; you can redistribute it and/or\r
// modify it under the terms of the GNU General Public License\r
#include "MainFrm.h"\r
#include "AboutDlg.h"\r
#include "CmdLineParser.h"\r
-#include "..\\version.h"\r
+#include "version.h"\r
#include "AppUtils.h"\r
#include "PathUtils.h"\r
#include "BrowseFolder.h"\r
+#include "DirFileEnum.h"\r
\r
#ifdef _DEBUG\r
#define new DEBUG_NEW\r
\r
// The one and only CTortoiseMergeApp object\r
CTortoiseMergeApp theApp;\r
-//CCrashReport g_crasher("crashreports@tortoisesvn.tigris.org", "Crash Report for TortoiseMerge " APP_X64_STRING " : " STRPRODUCTVER, TRUE);\r
+CCrashReport g_crasher("tortoisesvn@gmail.com", "Crash Report for TortoiseMerge " APP_X64_STRING " : " STRPRODUCTVER, TRUE);\r
\r
// CTortoiseMergeApp initialization\r
BOOL CTortoiseMergeApp::InitInstance()\r
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));\r
CMFCButton::EnableWindowsTheming();\r
//set the resource dll for the required language\r
- CRegDWORD loc = CRegDWORD(_T("Software\\TortoiseGit\\LanguageID"), 1033);\r
+ CRegDWORD loc = CRegDWORD(_T("Software\\TortoiseSVN\\LanguageID"), 1033);\r
long langId = loc;\r
CString langDll;\r
HINSTANCE hInst = NULL;\r
sHelppath = CPathUtils::GetAppParentDirectory() + _T("Languages\\TortoiseMerge_en.chm");\r
do\r
{\r
- GetLocaleInfo(MAKELCID(langId, SORT_DEFAULT), LOCALE_SISO639LANGNAME, buf, sizeof(buf));\r
+ GetLocaleInfo(MAKELCID(langId, SORT_DEFAULT), LOCALE_SISO639LANGNAME, buf, sizeof(buf)/sizeof(TCHAR));\r
CString sLang = _T("_");\r
sLang += buf;\r
sHelppath.Replace(_T("_en"), sLang);\r
break;\r
}\r
sHelppath.Replace(sLang, _T("_en"));\r
- GetLocaleInfo(MAKELCID(langId, SORT_DEFAULT), LOCALE_SISO3166CTRYNAME, buf, sizeof(buf));\r
+ GetLocaleInfo(MAKELCID(langId, SORT_DEFAULT), LOCALE_SISO3166CTRYNAME, buf, sizeof(buf)/sizeof(TCHAR));\r
sLang += _T("_");\r
sLang += buf;\r
sHelppath.Replace(_T("_en"), sLang);\r
langId = 0;\r
} while (langId);\r
setlocale(LC_ALL, ""); \r
+ // We need to explicitly set the thread locale to the system default one to avoid possible problems with saving files in its original codepage\r
+ // The problems occures when the language of OS differs from the regional settings\r
+ // See the details here: http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=100887\r
+ SetThreadLocale(LOCALE_SYSTEM_DEFAULT);\r
\r
// InitCommonControls() is required on Windows XP if an application\r
// manifest specifies use of ComCtl32.dll version 6 or later to enable\r
pFrame->ActivateFrame();\r
pFrame->ShowWindow(SW_SHOW);\r
pFrame->UpdateWindow();\r
+ pFrame->ShowDiffBar(!pFrame->m_bOneWay);\r
if (!pFrame->m_Data.IsBaseFileInUse() && pFrame->m_Data.m_sPatchPath.IsEmpty() && pFrame->m_Data.m_sDiffFile.IsEmpty())\r
{\r
pFrame->OnFileOpen();\r
return TRUE;\r
}\r
+\r
return pFrame->LoadViews();\r
}\r
\r
TCHAR * path = new TCHAR[len+1];\r
TCHAR * tempF = new TCHAR[len+100];\r
GetTempPath (len+1, path);\r
- GetTempFileName (path, TEXT("svn"), 0, tempF);\r
+ GetTempFileName (path, TEXT("tsm"), 0, tempF);\r
std::wstring sTempFile = std::wstring(tempF);\r
delete [] path;\r
delete [] tempF;\r
}\r
return 0;\r
}\r
+\r
+int CTortoiseMergeApp::ExitInstance()\r
+{\r
+ // Look for temporary files left around by TortoiseMerge and\r
+ // remove them. But only delete 'old' files \r
+ DWORD len = ::GetTempPath(0, NULL);\r
+ TCHAR * path = new TCHAR[len + 100];\r
+ len = ::GetTempPath (len+100, path);\r
+ if (len != 0)\r
+ {\r
+ CSimpleFileFind finder = CSimpleFileFind(path, _T("*tsm*.*"));\r
+ FILETIME systime_;\r
+ ::GetSystemTimeAsFileTime(&systime_);\r
+ __int64 systime = (((_int64)systime_.dwHighDateTime)<<32) | ((__int64)systime_.dwLowDateTime);\r
+ while (finder.FindNextFileNoDirectories())\r
+ {\r
+ CString filepath = finder.GetFilePath();\r
+ HANDLE hFile = ::CreateFile(filepath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL);\r
+ if (hFile != INVALID_HANDLE_VALUE)\r
+ {\r
+ FILETIME createtime_;\r
+ if (::GetFileTime(hFile, &createtime_, NULL, NULL))\r
+ {\r
+ ::CloseHandle(hFile);\r
+ __int64 createtime = (((_int64)createtime_.dwHighDateTime)<<32) | ((__int64)createtime_.dwLowDateTime);\r
+ if ((createtime + 864000000000) < systime) //only delete files older than a day\r
+ {\r
+ ::SetFileAttributes(filepath, FILE_ATTRIBUTE_NORMAL);\r
+ ::DeleteFile(filepath);\r
+ }\r
+ }\r
+ else\r
+ ::CloseHandle(hFile);\r
+ }\r
+ }\r
+ } \r
+ delete[] path; \r
+\r
+ return CWinAppEx::ExitInstance();\r
+}\r