forked from qt-creator/qt-creator
Gerrit: Improve curl detection
Until Git for Windows 2.12.0, curl was shipped twice - a MinGW version in mingw{32,64}/bin, and MSYS2 version in usr/bin[1]. On 2.12.0, the MSYS2 version was removed, leaving only MinGW. The plugin only searches for curl in usr/bin, so it is clearly broken with 2.12. There is no reason to add mingw*/bin to GitClient::gitBinDirectory() (and return a list), because there are no other useful tools there. The other tools that use gitBinDirectory are patch and ssh, which are both in usr/bin. [1] https://github.com/git-for-windows/git/issues/1069 Change-Id: I5eb5fa727fa384835792c59fd018fdfa31594927 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
4e7e5da8eb
commit
ffbdfb883a
@@ -30,6 +30,7 @@
|
||||
#include <utils/pathchooser.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QRegularExpression>
|
||||
#include <QSettings>
|
||||
@@ -59,14 +60,30 @@ static inline QString detectApp(const char *defaultExe)
|
||||
{
|
||||
const QString defaultApp = HostOsInfo::withExecutableSuffix(QLatin1String(defaultExe));
|
||||
QString app = QStandardPaths::findExecutable(defaultApp);
|
||||
if (!app.isEmpty())
|
||||
if (!app.isEmpty() || !HostOsInfo::isWindowsHost())
|
||||
return app;
|
||||
if (HostOsInfo::isWindowsHost()) { // Windows: Use app.exe from git if it cannot be found.
|
||||
FileName path = GerritPlugin::gitBinDirectory();
|
||||
if (!path.isEmpty())
|
||||
app = path.appendPath(defaultApp).toString();
|
||||
}
|
||||
return app;
|
||||
// Windows: Use app.exe from git if it cannot be found.
|
||||
const FileName gitBinDir = GerritPlugin::gitBinDirectory();
|
||||
if (gitBinDir.isEmpty())
|
||||
return QString();
|
||||
FileName path = gitBinDir;
|
||||
path.appendPath(defaultApp);
|
||||
if (path.exists())
|
||||
return path.toString();
|
||||
|
||||
// If app was not found, and git bin is Git/usr/bin (Git for Windows),
|
||||
// search also in Git/mingw{32,64}/bin
|
||||
if (!gitBinDir.endsWith("/usr/bin"))
|
||||
return QString();
|
||||
path = gitBinDir.parentDir().parentDir();
|
||||
QDir dir(path.toString());
|
||||
const QStringList entries = dir.entryList({"mingw*"});
|
||||
if (entries.isEmpty())
|
||||
return QString();
|
||||
path.appendPath(entries.first()).appendPath("bin").appendPath(defaultApp);
|
||||
if (path.exists())
|
||||
return path.toString();
|
||||
return QString();
|
||||
}
|
||||
|
||||
static inline QString detectSsh()
|
||||
|
Reference in New Issue
Block a user