forked from qt-creator/qt-creator
Git: Factor out resolving of bin directory on Windows
Change-Id: Ifbafa0f5cb8329faedfd1da3674b87e46001acc3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
36d2f47dcc
commit
54db877297
@@ -2636,6 +2636,24 @@ bool GitClient::launchGitGui(const QString &workingDirectory) {
|
||||
return success;
|
||||
}
|
||||
|
||||
Utils::FileName GitClient::gitBinDirectory()
|
||||
{
|
||||
const QString git = gitBinaryPath();
|
||||
if (git.isEmpty())
|
||||
return Utils::FileName();
|
||||
|
||||
// Is 'git\cmd' in the path (folder containing .bats)?
|
||||
QString path = QFileInfo(git).absolutePath();
|
||||
// Git for Windows (msysGit) has git and gitk redirect executables in {setup dir}/cmd
|
||||
// and the real binaries are in {setup dir}/bin. If cmd is configured in PATH
|
||||
// or in Git settings, return bin instead.
|
||||
if (Utils::HostOsInfo::isWindowsHost()
|
||||
&& path.endsWith(QLatin1String("/cmd"), Utils::HostOsInfo::fileNameCaseSensitivity())) {
|
||||
path.replace(path.size() - 3, 3, QLatin1String("bin"));
|
||||
}
|
||||
return Utils::FileName::fromString(path);
|
||||
}
|
||||
|
||||
QString GitClient::gitBinaryPath(bool *ok, QString *errorMessage) const
|
||||
{
|
||||
return settings()->gitBinaryPath(ok, errorMessage);
|
||||
|
||||
Reference in New Issue
Block a user