1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2012 - TortoiseGit
4 // Copyright (C) 2003-2008 - TortoiseSVN
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include "TortoiseProc.h"
22 #include "SysImageList.h"
23 #include "..\Utils\CrashReport.h"
24 #include "CmdLineParser.h"
27 #include "PathUtils.h"
28 #include "UnicodeUtils.h"
29 #include "MessageBox.h"
30 //#include "libintl.h"
31 #include "DirFileEnum.h"
32 //#include "SoundUtils.h"
33 #include "GitAdminDir.h"
35 #include "SmartHandle.h"
36 #include "Commands\Command.h"
37 #include "..\version.h"
38 #include "JumpListHelpers.h"
39 #include "SinglePropSheetDlg.h"
40 #include "Settings\setmainpage.h"
41 #include "..\Settings\Settings.h"
43 #include "Libraries.h"
45 #define STRUCT_IOVEC_DEFINED
51 #pragma comment(linker, "\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
53 #define APPID (_T("TGIT.TGIT.1") _T(TGIT_PLATFORM))
55 BEGIN_MESSAGE_MAP(CTortoiseProcApp
, CWinAppEx
)
56 ON_COMMAND(ID_HELP
, CWinAppEx::OnHelp
)
60 //CString CGit::m_MsysGitPath;
61 //////////////////////////////////////////////////////////////////////////
63 CTortoiseProcApp::CTortoiseProcApp()
66 CCrashReport::Instance().AddUserInfoToReport(L
"CommandLine", GetCommandLine());
69 // const char* const * argv = NULL;
72 m_bLoadUserToolbars
= FALSE
;
78 CTortoiseProcApp::~CTortoiseProcApp()
81 SYS_IMAGE_LIST().Cleanup();
84 // The one and only CTortoiseProcApp object
85 CTortoiseProcApp theApp
;
89 BOOL
CTortoiseProcApp::CheckMsysGitDir()
91 //CGitIndexFileMap map;
94 //path.SetFromGit(_T("src/gpl.txt"));
95 //map.GetFileStatus(_T("D:\\TortoiseGit"),&path, &status);
96 return g_Git
.CheckMsysGitDir();
98 CCrashReportTGit
crasher(L
"TortoiseGit " _T(APP_X64_STRING
));
100 // CTortoiseProcApp initialization
102 BOOL
CTortoiseProcApp::InitInstance()
105 CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows
));
106 CMFCButton::EnableWindowsTheming();
108 Gdiplus::GdiplusStartupInput gdiplusStartupInput
;
109 Gdiplus::GdiplusStartup(&m_gdiplusToken
,&gdiplusStartupInput
,NULL
);
111 //set the resource dll for the required language
112 CRegDWORD loc
= CRegDWORD(_T("Software\\TortoiseGit\\LanguageID"), 1033);
115 CStringA langpath
= CStringA(CPathUtils::GetAppParentDirectory());
116 langpath
+= "Languages";
117 // bindtextdomain("subversion", (LPCSTR)langpath);
118 // bind_textdomain_codeset("subversion", "UTF-8");
119 HINSTANCE hInst
= NULL
;
122 langDll
.Format(_T("%sLanguages\\TortoiseProc%d.dll"), (LPCTSTR
)CPathUtils::GetAppParentDirectory(), langId
);
124 hInst
= LoadLibrary(langDll
);
126 CString sVer
= _T(STRPRODUCTVER
);
127 CString sFileVer
= CPathUtils::GetVersionFromFile(langDll
);
128 if (sFileVer
.Compare(sVer
)!=0)
135 AfxSetResourceHandle(hInst
);
139 DWORD lid
= SUBLANGID(langId
);
143 langId
= MAKELANGID(PRIMARYLANGID(langId
), lid
);
148 } while ((hInst
== NULL
) && (langId
!= 0));
150 _tcscpy_s(buf
, _T("en"));
153 sHelppath
= this->m_pszHelpFilePath
;
154 sHelppath
= sHelppath
.MakeLower();
155 // MFC uses a help file with the same name as the application by default,
156 // which means we have to change that default to our language specific help files
157 sHelppath
.Replace(_T("tortoiseproc.chm"), _T("TortoiseGit_en.chm"));
158 free((void*)m_pszHelpFilePath
);
159 m_pszHelpFilePath
=_tcsdup(sHelppath
);
160 sHelppath
= CPathUtils::GetAppParentDirectory() + _T("Languages\\TortoiseGit_en.chm");
163 CString sLang
= _T("_");
164 if (GetLocaleInfo(MAKELCID(langId
, SORT_DEFAULT
), LOCALE_SISO639LANGNAME
, buf
, _countof(buf
)))
167 sHelppath
.Replace(_T("_en"), sLang
);
168 if (PathFileExists(sHelppath
))
170 free((void*)m_pszHelpFilePath
);
171 m_pszHelpFilePath
=_tcsdup(sHelppath
);
175 sHelppath
.Replace(sLang
, _T("_en"));
176 if (GetLocaleInfo(MAKELCID(langId
, SORT_DEFAULT
), LOCALE_SISO3166CTRYNAME
, buf
, _countof(buf
)))
180 sHelppath
.Replace(_T("_en"), sLang
);
181 if (PathFileExists(sHelppath
))
183 free((void*)m_pszHelpFilePath
);
184 m_pszHelpFilePath
=_tcsdup(sHelppath
);
188 sHelppath
.Replace(sLang
, _T("_en"));
190 DWORD lid
= SUBLANGID(langId
);
194 langId
= MAKELANGID(PRIMARYLANGID(langId
), lid
);
199 setlocale(LC_ALL
, "");
201 if(!CheckMsysGitDir())
203 UINT ret
= CMessageBox::Show(NULL
, IDS_PROC_NOMSYSGIT
, IDS_APPNAME
, 3, IDI_HAND
, IDS_PROC_SETMSYSGITPATH
, IDS_PROC_GOTOMSYSGITWEBSITE
, IDS_ABORTBUTTON
);
206 ShellExecute(NULL
, NULL
, _T("http://code.google.com/p/msysgit/"), NULL
, NULL
, SW_SHOW
);
210 // open settings dialog
211 CSinglePropSheetDlg(CString(MAKEINTRESOURCE(IDS_PROC_SETTINGS_TITLE
)), new CSetMainPage(), this->GetMainWnd()).DoModal();
215 if (CAppUtils::GetMsysgitVersion() < 0x01070a00)
217 int ret
= CMessageBox::ShowCheck(NULL
, IDS_PROC_OLDMSYSGIT
, IDS_APPNAME
, 1, IDI_EXCLAMATION
, IDS_PROC_GOTOMSYSGITWEBSITE
, IDS_ABORTBUTTON
, IDS_IGNOREBUTTON
, _T("OldMsysgitVersionWarning"), IDS_PROC_NOTSHOWAGAINIGNORE
);
220 CRegStdDWORD(_T("Software\\TortoiseGit\\TortoiseProc\\OldMsysgitVersionWarning")).removeValue(); // only store answer if it is "Ignore"
221 ShellExecute(NULL
, NULL
, _T("http://code.google.com/p/msysgit/"), NULL
, NULL
, SW_SHOW
);
226 CRegStdDWORD(_T("Software\\TortoiseGit\\TortoiseProc\\OldMsysgitVersionWarning")).removeValue(); // only store answer if it is "Ignore"
231 // InitCommonControls() is required on Windows XP if an application
232 // manifest specifies use of ComCtl32.dll version 6 or later to enable
233 // visual styles. Otherwise, any window creation will fail.
235 INITCOMMONCONTROLSEX used
= {
236 sizeof(INITCOMMONCONTROLSEX
),
237 ICC_ANIMATE_CLASS
| ICC_BAR_CLASSES
| ICC_COOL_CLASSES
| ICC_DATE_CLASSES
|
238 ICC_HOTKEY_CLASS
| ICC_INTERNET_CLASSES
| ICC_LISTVIEW_CLASSES
|
239 ICC_NATIVEFNTCTL_CLASS
| ICC_PAGESCROLLER_CLASS
| ICC_PROGRESS_CLASS
|
240 ICC_TAB_CLASSES
| ICC_TREEVIEW_CLASSES
| ICC_UPDOWN_CLASS
|
241 ICC_USEREX_CLASSES
| ICC_WIN95_CLASSES
243 InitCommonControlsEx(&used
);
245 AfxEnableControlContainer();
247 CWinAppEx::InitInstance();
248 SetRegistryKey(_T("TortoiseGit"));
250 CCmdLineParser
parser(AfxGetApp()->m_lpCmdLine
);
253 CString sVal
= parser
.GetVal(_T("hwnd"));
255 hWndExplorer
= (HWND
)_ttoi64(sVal
);
257 while (GetParent(hWndExplorer
)!=NULL
)
258 hWndExplorer
= GetParent(hWndExplorer
);
259 if (!IsWindow(hWndExplorer
))
264 // if HKCU\Software\TortoiseGit\Debug is not 0, show our command line
266 if (CRegDWORD(_T("Software\\TortoiseGit\\Debug"), FALSE
)==TRUE
)
267 AfxMessageBox(AfxGetApp()->m_lpCmdLine
, MB_OK
| MB_ICONINFORMATION
);
269 if ( parser
.HasKey(_T("path")) && parser
.HasKey(_T("pathfile")))
271 CMessageBox::Show(NULL
, IDS_ERR_INVALIDPATH
, IDS_APPNAME
, MB_ICONERROR
);
275 CTGitPath cmdLinePath
;
276 CTGitPathList pathList
;
277 if ( parser
.HasKey(_T("pathfile")) )
280 CString sPathfileArgument
= CPathUtils::GetLongPathname(parser
.GetVal(_T("pathfile")));
282 cmdLinePath
.SetFromUnknown(sPathfileArgument
);
283 if (pathList
.LoadFromFile(cmdLinePath
)==false)
284 return FALSE
; // no path specified!
285 if ( parser
.HasKey(_T("deletepathfile")) )
287 // We can delete the temporary path file, now that we've loaded it
288 ::DeleteFile(cmdLinePath
.GetWinPath());
290 // This was a path to a temporary file - it's got no meaning now, and
291 // anybody who uses it again is in for a problem...
298 CString sPathArgument
= CPathUtils::GetLongPathname(parser
.GetVal(_T("path")));
299 if (parser
.HasKey(_T("expaths")))
301 // an /expaths param means we're started via the buttons in our Win7 library
302 // and that means the value of /expaths is the current directory, and
303 // the selected paths are then added as additional parameters but without a key, only a value
305 // because of the "strange treatment of quotation marks and backslashes by CommandLineToArgvW"
306 // we have to escape the backslashes first. Since we're only dealing with paths here, that's
308 // Without this, a command line like:
309 // /command:commit /expaths:"D:\" "D:\Utils"
310 // would fail because the "D:\" is treated as the backslash being the escape char for the quotation
311 // mark and we'd end up with:
312 // argv[1] = /command:commit
313 // argv[2] = /expaths:D:" D:\Utils
314 // See here for more details: http://blogs.msdn.com/b/oldnewthing/archive/2010/09/17/10063629.aspx
315 CString cmdLine
= GetCommandLineW();
316 cmdLine
.Replace(L
"\\", L
"\\\\");
318 LPWSTR
*szArglist
= CommandLineToArgvW(cmdLine
, &nArgs
);
321 // argument 0 is the process path, so start with 1
322 for (int i
=1; i
<nArgs
; i
++)
324 if (szArglist
[i
][0] != '/')
326 if (!sPathArgument
.IsEmpty())
327 sPathArgument
+= '*';
328 sPathArgument
+= szArglist
[i
];
331 sPathArgument
.Replace(L
"\\\\", L
"\\");
333 LocalFree(szArglist
);
335 if (sPathArgument
.IsEmpty() && parser
.HasKey(L
"path"))
337 CMessageBox::Show(hWndExplorer
, IDS_ERR_INVALIDPATH
, IDS_APPNAME
, MB_ICONERROR
);
340 int asterisk
= sPathArgument
.Find('*');
341 cmdLinePath
.SetFromUnknown(asterisk
>= 0 ? sPathArgument
.Left(asterisk
) : sPathArgument
);
342 pathList
.LoadFromAsteriskSeparatedString(sPathArgument
);
345 if (pathList
.GetCount() == 0) {
346 pathList
.AddPath(CTGitPath::CTGitPath(g_Git
.m_CurrentDir
));
349 InitializeJumpList();
350 EnsureGitLibrary(false);
352 // Subversion sometimes writes temp files to the current directory!
353 // Since TSVN doesn't need a specific CWD anyway, we just set it
354 // to the users temp folder: that way, Subversion is guaranteed to
355 // have write access to the CWD
357 DWORD len
= GetCurrentDirectory(0, NULL
);
360 auto_buffer
<TCHAR
> originalCurrentDirectory(len
);
361 if (GetCurrentDirectory(len
, originalCurrentDirectory
))
363 sOrigCWD
= originalCurrentDirectory
;
364 sOrigCWD
= CPathUtils::GetLongPathname(sOrigCWD
);
367 TCHAR pathbuf
[MAX_PATH
];
368 GetTempPath(MAX_PATH
, pathbuf
);
369 SetCurrentDirectory(pathbuf
);
372 CheckForNewerVersion();
374 if (parser
.HasVal(_T("configdir")))
376 // the user can override the location of the Subversion config directory here
377 CString sConfigDir
= parser
.GetVal(_T("configdir"));
378 // g_GitGlobal.SetConfigDir(sConfigDir);
381 CAutoGeneralHandle TGitMutex
= ::CreateMutex(NULL
, FALSE
, _T("TortoiseGitProc.exe"));
382 if (!g_Git
.SetCurrentDir(cmdLinePath
.GetWinPathString(), parser
.HasKey(_T("submodule")) == TRUE
))
385 for(i
=0;i
<pathList
.GetCount();i
++)
386 if(g_Git
.SetCurrentDir(pathList
[i
].GetWinPath()))
390 if(!g_Git
.m_CurrentDir
.IsEmpty())
392 sOrigCWD
= g_Git
.m_CurrentDir
;
393 SetCurrentDirectory(g_Git
.m_CurrentDir
);
400 // requires CWD to be set
401 CGit::m_LogEncode
= CAppUtils::GetLogOutputEncode();
410 UINT choice
= CMessageBox::Show(hWndExplorer
, err
, _T("TortoiseGit"), 1, IDI_ERROR
, CString(MAKEINTRESOURCE(IDS_PROC_EDITLOCALGITCONFIG
)), CString(MAKEINTRESOURCE(IDS_PROC_EDITGLOBALGITCONFIG
)), CString(MAKEINTRESOURCE(IDS_ABORTBUTTON
)));
413 // open the config file with alternative editor
414 CAppUtils::LaunchAlternativeEditor(g_Git
.GetGitLocalConfig());
416 else if (choice
== 2)
418 // open the global config file with alternative editor
419 CAppUtils::LaunchAlternativeEditor(g_Git
.GetGitGlobalConfig());
425 // execute the requested command
426 CommandServer server
;
427 Command
* cmd
= server
.GetCommand(parser
.GetVal(_T("command")));
430 cmd
->SetExplorerHwnd(hWndExplorer
);
432 cmd
->SetParser(parser
);
433 cmd
->SetPaths(pathList
, cmdLinePath
);
435 retSuccess
= cmd
->Execute();
439 // Look for temporary files left around by TortoiseSVN and
440 // remove them. But only delete 'old' files because some
441 // apps might still be needing the recent ones.
443 DWORD len
= ::GetTempPath(0, NULL
);
444 TCHAR
* path
= new TCHAR
[len
+ 100];
445 len
= ::GetTempPath (len
+100, path
);
448 CSimpleFileFind finder
= CSimpleFileFind(path
, _T("*svn*.*"));
450 ::GetSystemTimeAsFileTime(&systime_
);
451 __int64 systime
= (((_int64
)systime_
.dwHighDateTime
)<<32) | ((__int64
)systime_
.dwLowDateTime
);
452 while (finder
.FindNextFileNoDirectories())
454 CString filepath
= finder
.GetFilePath();
455 HANDLE hFile
= ::CreateFile(filepath
, GENERIC_READ
, FILE_SHARE_READ
, NULL
, OPEN_EXISTING
, NULL
, NULL
);
456 if (hFile
!= INVALID_HANDLE_VALUE
)
458 FILETIME createtime_
;
459 if (::GetFileTime(hFile
, &createtime_
, NULL
, NULL
))
461 ::CloseHandle(hFile
);
462 __int64 createtime
= (((_int64
)createtime_
.dwHighDateTime
)<<32) | ((__int64
)createtime_
.dwLowDateTime
);
463 if ((createtime
+ 864000000000) < systime
) //only delete files older than a day
465 ::SetFileAttributes(filepath
, FILE_ATTRIBUTE_NORMAL
);
466 ::DeleteFile(filepath
);
470 ::CloseHandle(hFile
);
477 // Since the dialog has been closed, return FALSE so that we exit the
478 // application, rather than start the application's message pump.
482 void CTortoiseProcApp::CheckUpgrade()
484 CRegString regVersion
= CRegString(_T("Software\\TortoiseGit\\CurrentVersion"));
485 CString sVersion
= regVersion
;
486 if (sVersion
.Compare(_T(STRPRODUCTVER
))==0)
488 // we're starting the first time with a new version!
491 int pos
= sVersion
.Find(',');
494 lVersion
= (_ttol(sVersion
.Left(pos
))<<24);
495 lVersion
|= (_ttol(sVersion
.Mid(pos
+1))<<16);
496 pos
= sVersion
.Find(',', pos
+1);
497 lVersion
|= (_ttol(sVersion
.Mid(pos
+1))<<8);
500 if (lVersion
<= 0x01070600)
505 CRegStdDWORD(_T("Software\\TortoiseGit\\ConvertBase")).removeValue();
506 CRegStdDWORD(_T("Software\\TortoiseGit\\DiffProps")).removeValue();
507 if (CRegStdDWORD(_T("Software\\TortoiseGit\\CheckNewer"), TRUE
) == FALSE
)
508 CRegStdDWORD(_T("Software\\TortoiseGit\\VersionCheck")) = FALSE
;
509 CRegStdDWORD(_T("Software\\TortoiseGit\\CheckNewer")).removeValue();
512 if (lVersion
<= 0x01010300)
514 CSoundUtils::RegisterTSVNSounds();
517 if (lVersion
<= 0x01020200)
519 // upgrade to > 1.2.3 means the doc diff scripts changed from vbs to js
520 // so remove the diff/merge scripts if they're the defaults
521 CRegString diffreg
= CRegString(_T("Software\\TortoiseGit\\DiffTools\\.doc"));
522 CString sDiff
= diffreg
;
523 CString sCL
= _T("wscript.exe \"") + CPathUtils::GetAppParentDirectory()+_T("Diff-Scripts\\diff-doc.vbs\"");
524 if (sDiff
.Left(sCL
.GetLength()).CompareNoCase(sCL
)==0)
526 CRegString mergereg
= CRegString(_T("Software\\TortoiseGit\\MergeTools\\.doc"));
528 sCL
= _T("wscript.exe \"") + CPathUtils::GetAppParentDirectory()+_T("Diff-Scripts\\merge-doc.vbs\"");
529 if (sDiff
.Left(sCL
.GetLength()).CompareNoCase(sCL
)==0)
532 if (lVersion
<= 0x01040000)
534 CRegStdDWORD(_T("Software\\TortoiseGit\\OwnerdrawnMenus")).removeValue();
537 // set the custom diff scripts for every user
538 CString scriptsdir
= CPathUtils::GetAppParentDirectory();
539 scriptsdir
+= _T("Diff-Scripts");
540 CSimpleFileFind
files(scriptsdir
);
541 while (files
.FindNextFileNoDirectories())
543 CString file
= files
.GetFilePath();
544 CString filename
= files
.GetFileName();
545 CString ext
= file
.Mid(file
.ReverseFind('-')+1);
546 ext
= _T(".")+ext
.Left(ext
.ReverseFind('.'));
548 if (file
.Right(3).CompareNoCase(_T("vbs"))==0)
550 kind
= _T(" //E:vbscript");
552 if (file
.Right(2).CompareNoCase(_T("js"))==0)
554 kind
= _T(" //E:javascript");
557 if (filename
.Left(5).CompareNoCase(_T("diff-"))==0)
559 CRegString diffreg
= CRegString(_T("Software\\TortoiseGit\\DiffTools\\")+ext
);
560 CString diffregstring
= diffreg
;
561 if ((diffregstring
.IsEmpty()) || (diffregstring
.Find(filename
)>=0))
562 diffreg
= _T("wscript.exe \"") + file
+ _T("\" %base %mine") + kind
;
564 if (filename
.Left(6).CompareNoCase(_T("merge-"))==0)
566 CRegString diffreg
= CRegString(_T("Software\\TortoiseGit\\MergeTools\\")+ext
);
567 CString diffregstring
= diffreg
;
568 if ((diffregstring
.IsEmpty()) || (diffregstring
.Find(filename
)>=0))
569 diffreg
= _T("wscript.exe \"") + file
+ _T("\" %merged %theirs %mine %base") + kind
;
573 // set the current version so we don't come here again until the next update!
574 regVersion
= _T(STRPRODUCTVER
);
577 void CTortoiseProcApp::InitializeJumpList()
579 // for Win7 : use a custom jump list
582 DeleteJumpList(APPID
);
583 DoInitializeJumpList();
587 void CTortoiseProcApp::DoInitializeJumpList()
589 ATL::CComPtr
<ICustomDestinationList
> pcdl
;
590 HRESULT hr
= pcdl
.CoCreateInstance(CLSID_DestinationList
, NULL
, CLSCTX_INPROC_SERVER
);
594 hr
= pcdl
->SetAppID(APPID
);
599 ATL::CComPtr
<IObjectArray
> poaRemoved
;
600 hr
= pcdl
->BeginList(&uMaxSlots
, IID_PPV_ARGS(&poaRemoved
));
604 ATL::CComPtr
<IObjectCollection
> poc
;
605 hr
= poc
.CoCreateInstance(CLSID_EnumerableObjectCollection
, NULL
, CLSCTX_INPROC_SERVER
);
609 CString sTemp
= CString(MAKEINTRESOURCE(IDS_MENUSETTINGS
));
612 ATL::CComPtr
<IShellLink
> psl
;
613 hr
= CreateShellLink(_T("/command:settings"), (LPCTSTR
)sTemp
, 20, &psl
);
617 sTemp
= CString(MAKEINTRESOURCE(IDS_MENUHELP
));
619 psl
.Release(); // Need to release the object before calling operator&()
620 hr
= CreateShellLink(_T("/command:help"), (LPCTSTR
)sTemp
, 19, &psl
);
625 ATL::CComPtr
<IObjectArray
> poa
;
626 hr
= poc
.QueryInterface(&poa
);
628 pcdl
->AppendCategory((LPCTSTR
)CString(MAKEINTRESOURCE(IDS_PROC_TASKS
)), poa
);
633 int CTortoiseProcApp::ExitInstance()
635 Gdiplus::GdiplusShutdown(m_gdiplusToken
);
637 CWinAppEx::ExitInstance();
643 void CTortoiseProcApp::CheckForNewerVersion()
645 // check for newer versions
646 if (CRegDWORD(_T("Software\\TortoiseGit\\VersionCheck"), TRUE
) != FALSE
)
652 if ((now
!= 0) && (localtime_s(&ptm
, &now
)==0))
655 // Check daily for new preview releases
656 CRegDWORD oldday
= CRegDWORD(_T("Software\\TortoiseGit\\CheckNewerDay"), (DWORD
)-1);
657 if (((DWORD
)oldday
) == -1)
658 oldday
= ptm
.tm_yday
;
661 if ((DWORD
)oldday
!= (DWORD
)ptm
.tm_yday
)
663 oldday
= ptm
.tm_yday
;
666 // we don't calculate the real 'week of the year' here
667 // because just to decide if we should check for an update
668 // that's not needed.
669 week
= ptm
.tm_yday
/ 7;
671 CRegDWORD oldweek
= CRegDWORD(_T("Software\\TortoiseGit\\CheckNewerWeek"), (DWORD
)-1);
672 if (((DWORD
)oldweek
) == -1)
673 oldweek
= week
; // first start of TortoiseProc, no update check needed
676 if ((DWORD
)week
!= oldweek
)
680 TCHAR com
[MAX_PATH
+100];
681 GetModuleFileName(NULL
, com
, MAX_PATH
);
682 _tcscat_s(com
, MAX_PATH
+100, _T(" /command:updatecheck"));
684 CAppUtils::LaunchApplication(com
, 0, false);