예제 #1
0
BOOL CSetMainPage::OnApply()
{
	UpdateData();

	PerformCommonGitPathCleanup(m_sMsysGitPath);
	UpdateData(FALSE);

	Store(m_dwLanguage, m_regLanguage);
	if (m_sMsysGitPath.Compare(CString(m_regMsysGitPath)) ||
		this->m_sMsysGitExtranPath.Compare(CString(m_regMsysGitExtranPath)))
	{
		Store(m_sMsysGitPath, m_regMsysGitPath);
		Store(m_sMsysGitExtranPath, m_regMsysGitExtranPath);
		m_restart = Restart_Cache;
	}
	Store(m_bCheckNewer, m_regCheckNewer);

	// only complete if the msysgit directory is ok
	g_Git.m_bInitialized = FALSE;
	if (g_Git.CheckMsysGitDir(FALSE))
	{
		SetModified(FALSE);
		return ISettingsPropPage::OnApply();
	}
	else
	{
		if (CMessageBox::Show(GetSafeHwnd(), L"Invalid git.exe path.\nCheck help file for \"Git.exe Path\".", L"TortoiseGit", 1, IDI_ERROR, CString(MAKEINTRESOURCE(IDS_MSGBOX_OK)), CString(MAKEINTRESOURCE(IDS_MSGBOX_HELP))) == 2)
			OnHelp();
		return 0;
	}
}
예제 #2
0
void CSetMainPage::OnMsysGitPathModify()
{
	this->UpdateData();
	CString str=this->m_sMsysGitPath;
	if(!str.IsEmpty())
	{
		PerformCommonGitPathCleanup(str);

		if(str.GetLength()>=3 && str.Find(_T("bin"), str.GetLength()-3) >=0)
		{
			str=str.Left(str.GetLength()-3);
			str += _T("mingw\\bin");
			if(::PathFileExists(str))
			{
				str+=_T(";");
				if(this->m_sMsysGitExtranPath.Find(str)<0)
				{
					m_sMsysGitExtranPath = str + m_sMsysGitExtranPath;
					this->UpdateData(FALSE);
				}
			}
		}
	}
	SetModified();
}
예제 #3
0
void CSetMainPage::OnBrowseDir()
{
	CBrowseFolder browseFolder;
	browseFolder.m_style = BIF_EDITBOX | BIF_NEWDIALOGSTYLE | BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
	CString dir;
	this->UpdateData(TRUE);
	dir=this->m_sMsysGitPath;
	if (browseFolder.Show(GetSafeHwnd(), dir) == CBrowseFolder::OK)
	{
		m_sMsysGitPath=dir;
		PerformCommonGitPathCleanup(m_sMsysGitPath);
		this->UpdateData(FALSE);
		OnMsysGitPathModify();
	}
	SetModified(TRUE);
}
예제 #4
0
void CSetMainPage::OnCheck()
{
	GetDlgItem(IDC_MSYSGIT_VER)->SetWindowText(L"");

	this->UpdateData(TRUE);

	PerformCommonGitPathCleanup(m_sMsysGitPath);
	UpdateData(FALSE);

	OnMsysGitPathModify();

	CString oldpath = m_regMsysGitPath;
	CString oldextranpath = this->m_regMsysGitExtranPath;

	Store(m_sMsysGitPath, m_regMsysGitPath);
	Store(m_sMsysGitExtranPath, m_regMsysGitExtranPath);

	g_Git.m_bInitialized = false;

	if (g_Git.CheckMsysGitDir(FALSE))
	{
		CString cmd;
		CString out;
		cmd=_T("git.exe --version");
		int ret = g_Git.Run(cmd,&out,CP_UTF8);
		this->GetDlgItem(IDC_MSYSGIT_VER)->SetWindowText(out);
		if (out.IsEmpty())
		{
			if (ret == 0xC0000135 && CMessageBox::Show(GetSafeHwnd(), L"Could not start git.exe. A dynamic library (dll) is missing.\nCheck help file for \"Extern DLL Path\".", L"TortoiseGit", 1, IDI_ERROR, CString(MAKEINTRESOURCE(IDS_MSGBOX_OK)), CString(MAKEINTRESOURCE(IDS_MSGBOX_HELP))) == 2)
				OnHelp();
			else if (CMessageBox::Show(GetSafeHwnd(), L"Could not get read version information from git.exe.\nCheck help file for \"Git.exe Path\".", L"TortoiseGit", 1, IDI_ERROR, CString(MAKEINTRESOURCE(IDS_MSGBOX_OK)), CString(MAKEINTRESOURCE(IDS_MSGBOX_HELP))) == 2)
				OnHelp();
		}
		else if (!(CGit::ms_bCygwinGit || CGit::ms_bMsys2Git) && out.Find(L"msysgit") == -1 && out.Find(L"windows") == -1 && CMessageBox::Show(GetSafeHwnd(), L"Could not find \"msysgit\" or \"windows\" in versionstring of git.exe.\nIf you are using git of the cygwin or msys2 environment please read the help file for the keyword \"cygwin git\" or \"msys2 git\".", L"TortoiseGit", 1, IDI_INFORMATION, CString(MAKEINTRESOURCE(IDS_MSGBOX_OK)), CString(MAKEINTRESOURCE(IDS_MSGBOX_HELP))) == 2)
			OnHelp();
	}
	else
	{
		if (CMessageBox::Show(GetSafeHwnd(), L"Invalid git.exe path.\nCheck help file for \"Git.exe Path\".", L"TortoiseGit", 1, IDI_ERROR, CString(MAKEINTRESOURCE(IDS_MSGBOX_OK)), CString(MAKEINTRESOURCE(IDS_MSGBOX_HELP))) == 2)
			OnHelp();
	}

	Store(oldpath, m_regMsysGitPath);
	Store(oldextranpath, m_regMsysGitExtranPath);
}
예제 #5
0
void CSetMainPage::OnCheck()
{
	GetDlgItem(IDC_MSYSGIT_VER)->SetWindowText(L"");

	this->UpdateData(TRUE);

	PerformCommonGitPathCleanup(m_sMsysGitPath);
	UpdateData(FALSE);

	OnMsysGitPathModify();

	CString oldpath = m_regMsysGitPath;
	CString oldextranpath = this->m_regMsysGitExtranPath;

	Store(m_sMsysGitPath, m_regMsysGitPath);
	Store(m_sMsysGitExtranPath, m_regMsysGitExtranPath);

	g_Git.m_bInitialized = false;

	if (g_Git.CheckMsysGitDir(FALSE))
	{
		CString cmd;
		CString out;
		cmd=_T("git.exe --version");
		int ret = g_Git.Run(cmd,&out,CP_UTF8);
		this->GetDlgItem(IDC_MSYSGIT_VER)->SetWindowText(out);
		if (out.IsEmpty())
		{
			if (ret == 0xC0000135 && CMessageBox::Show(NULL, _T("Could not start git.exe. A dynamic library (dll) is missing.\nCheck help file for \"Extern DLL Path\"."), _T("TortoiseGit"), 1, IDI_ERROR, CString(MAKEINTRESOURCE(IDS_MSGBOX_OK)), CString(MAKEINTRESOURCE(IDS_MSGBOX_HELP))) == 2)
				OnHelp();
			else if (CMessageBox::Show(NULL, _T("Could not get read version information from git.exe.\nCheck help file for \"Git.exe Path\"."),_T("TortoiseGit"), 1, IDI_ERROR, CString(MAKEINTRESOURCE(IDS_MSGBOX_OK)), CString(MAKEINTRESOURCE(IDS_MSGBOX_HELP))) == 2)
				OnHelp();
		}
	}
	else
	{
		if (CMessageBox::Show(NULL, _T("Invalid git.exe path.\nCheck help file for \"Git.exe Path\"."), _T("TortoiseGit"), 1, IDI_ERROR, CString(MAKEINTRESOURCE(IDS_MSGBOX_OK)), CString(MAKEINTRESOURCE(IDS_MSGBOX_HELP))) == 2)
			OnHelp();
	}

	Store (oldpath, m_regMsysGitPath);
	Store (oldextranpath, m_regMsysGitExtranPath);
}
예제 #6
0
BOOL CSetMainPage::OnApply()
{
	UpdateData();

	PerformCommonGitPathCleanup(m_sMsysGitPath);
	UpdateData(FALSE);

	Store(m_dwLanguage, m_regLanguage);
	if (m_sMsysGitPath.Compare(CString(m_regMsysGitPath)) ||
		this->m_sMsysGitExtranPath.Compare(CString(m_regMsysGitExtranPath)))
	{
		Store(m_sMsysGitPath, m_regMsysGitPath);
		Store(m_sMsysGitExtranPath, m_regMsysGitExtranPath);
		m_restart = Restart_Cache;
	}
	Store(m_bCheckNewer, m_regCheckNewer);

	// only complete if the msysgit directory is ok
	if (!CheckGitExe(GetSafeHwnd(), m_sMsysGitPath, m_sMsysGitExtranPath, IDC_MSYSGIT_VER, [&](UINT helpid) { HtmlHelp(0x20000 + helpid); }))
		return 0;

	SetModified(FALSE);
	return ISettingsPropPage::OnApply();
}