Merge remote-tracking branch 'origin/4.5'

Change-Id: I0a4a1b6787afc817acf2b7a1c3fd2b881c35f57a
This commit is contained in:
Eike Ziller
2017-10-13 11:59:49 +02:00
13 changed files with 86 additions and 48 deletions

View File

@@ -56,6 +56,7 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/runextensions.h> #include <utils/runextensions.h>
#include <utils/synchronousprocess.h> #include <utils/synchronousprocess.h>
#include <utils/environment.h>
#include <QApplication> #include <QApplication>
#include <QDirIterator> #include <QDirIterator>
@@ -1070,6 +1071,19 @@ bool AndroidConfigurations::force32bitEmulator()
return m_instance->m_force32bit; return m_instance->m_force32bit;
} }
QProcessEnvironment AndroidConfigurations::toolsEnvironment(const AndroidConfig &config)
{
Environment env = Environment::systemEnvironment();
Utils::FileName jdkLocation = config.openJDKLocation();
if (!jdkLocation.isEmpty()) {
env.set("JAVA_HOME", jdkLocation.toUserOutput());
Utils::FileName binPath = jdkLocation;
binPath.appendPath("bin");
env.prependOrSetPath(binPath.toUserOutput());
}
return env.toProcessEnvironment();
}
/** /**
* Workaround for '????????????' serial numbers * Workaround for '????????????' serial numbers
* @return ("-d") for buggy devices, ("-s", <serial no>) for normal * @return ("-d") for buggy devices, ("-s", <serial no>) for normal

View File

@@ -30,6 +30,7 @@
#include <projectexplorer/toolchain.h> #include <projectexplorer/toolchain.h>
#include <QObject> #include <QObject>
#include <QProcessEnvironment>
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
#include <QVector> #include <QVector>
@@ -204,6 +205,7 @@ public:
static void removeOldToolChains(); static void removeOldToolChains();
static void updateAutomaticKitList(); static void updateAutomaticKitList();
static bool force32bitEmulator(); static bool force32bitEmulator();
static QProcessEnvironment toolsEnvironment(const AndroidConfig &config);
signals: signals:
void updated(); void updated();

View File

@@ -129,13 +129,14 @@ void watcherDeleter(QFutureWatcher<void> *watcher)
Runs the \c sdkmanger tool with arguments \a args. Returns \c true if the command is Runs the \c sdkmanger tool with arguments \a args. Returns \c true if the command is
successfully executed. Output is copied into \a output. The function blocks the calling thread. successfully executed. Output is copied into \a output. The function blocks the calling thread.
*/ */
static bool sdkManagerCommand(const Utils::FileName &toolPath, const QStringList &args, static bool sdkManagerCommand(const AndroidConfig &config, const QStringList &args,
QString *output, int timeout = sdkManagerCmdTimeoutS) QString *output, int timeout = sdkManagerCmdTimeoutS)
{ {
SynchronousProcess proc; SynchronousProcess proc;
proc.setProcessEnvironment(AndroidConfigurations::toolsEnvironment(config));
proc.setTimeoutS(timeout); proc.setTimeoutS(timeout);
proc.setTimeOutMessageBoxEnabled(true); proc.setTimeOutMessageBoxEnabled(true);
SynchronousProcessResponse response = proc.run(toolPath.toString(), args); SynchronousProcessResponse response = proc.run(config.sdkManagerToolPath().toString(), args);
if (output) if (output)
*output = response.allOutput(); *output = response.allOutput();
return response.result == SynchronousProcessResponse::Finished; return response.result == SynchronousProcessResponse::Finished;
@@ -147,13 +148,14 @@ static bool sdkManagerCommand(const Utils::FileName &toolPath, const QStringList
to cancel signal emmitted by \a sdkManager and kill the commands. The command is also killed to cancel signal emmitted by \a sdkManager and kill the commands. The command is also killed
after the lapse of \a timeout seconds. The function blocks the calling thread. after the lapse of \a timeout seconds. The function blocks the calling thread.
*/ */
static void sdkManagerCommand(const Utils::FileName &toolPath, const QStringList &args, static void sdkManagerCommand(const AndroidConfig &config, const QStringList &args,
AndroidSdkManager &sdkManager, SdkCmdFutureInterface &fi, AndroidSdkManager &sdkManager, SdkCmdFutureInterface &fi,
AndroidSdkManager::OperationOutput &output, double progressQuota, AndroidSdkManager::OperationOutput &output, double progressQuota,
bool interruptible = true, int timeout = sdkManagerOperationTimeoutS) bool interruptible = true, int timeout = sdkManagerOperationTimeoutS)
{ {
int offset = fi.progressValue(); int offset = fi.progressValue();
SynchronousProcess proc; SynchronousProcess proc;
proc.setProcessEnvironment(AndroidConfigurations::toolsEnvironment(config));
bool assertionFound = false; bool assertionFound = false;
proc.setStdErrBufferedSignalsEnabled(true); proc.setStdErrBufferedSignalsEnabled(true);
proc.setStdOutBufferedSignalsEnabled(true); proc.setStdOutBufferedSignalsEnabled(true);
@@ -173,7 +175,7 @@ static void sdkManagerCommand(const Utils::FileName &toolPath, const QStringList
QObject::connect(&sdkManager, &AndroidSdkManager::cancelActiveOperations, QObject::connect(&sdkManager, &AndroidSdkManager::cancelActiveOperations,
&proc, &SynchronousProcess::terminate); &proc, &SynchronousProcess::terminate);
} }
SynchronousProcessResponse response = proc.run(toolPath.toString(), args); SynchronousProcessResponse response = proc.run(config.sdkManagerToolPath().toString(), args);
if (assertionFound) { if (assertionFound) {
output.success = false; output.success = false;
output.stdOutput = response.stdOut(); output.stdOutput = response.stdOut();
@@ -769,7 +771,7 @@ void AndroidSdkManagerPrivate::reloadSdkPackages()
QString packageListing; QString packageListing;
QStringList args({"--list", "--verbose"}); QStringList args({"--list", "--verbose"});
args << m_config.sdkManagerToolArgs(); args << m_config.sdkManagerToolArgs();
if (sdkManagerCommand(m_config.sdkManagerToolPath(), args, &packageListing)) { if (sdkManagerCommand(m_config, args, &packageListing)) {
SdkManagerOutputParser parser(m_allPackages); SdkManagerOutputParser parser(m_allPackages);
parser.parsePackageListing(packageListing); parser.parsePackageListing(packageListing);
} }
@@ -797,7 +799,7 @@ void AndroidSdkManagerPrivate::updateInstalled(SdkCmdFutureInterface &fi)
QStringList args("--update"); QStringList args("--update");
args << m_config.sdkManagerToolArgs(); args << m_config.sdkManagerToolArgs();
if (!fi.isCanceled()) if (!fi.isCanceled())
sdkManagerCommand(m_config.sdkManagerToolPath(), args, m_sdkManager, fi, result, 100); sdkManagerCommand(m_config, args, m_sdkManager, fi, result, 100);
else else
qCDebug(sdkManagerLog) << "Update: Operation cancelled before start"; qCDebug(sdkManagerLog) << "Update: Operation cancelled before start";
@@ -826,12 +828,10 @@ void AndroidSdkManagerPrivate::update(SdkCmdFutureInterface &fi, const QStringLi
result.stdOutput = QString("%1 %2").arg(isInstall ? installTag : uninstallTag) result.stdOutput = QString("%1 %2").arg(isInstall ? installTag : uninstallTag)
.arg(packagePath); .arg(packagePath);
fi.reportResult(result); fi.reportResult(result);
if (fi.isCanceled()) { if (fi.isCanceled())
qCDebug(sdkManagerLog) << args << "Update: Operation cancelled before start"; qCDebug(sdkManagerLog) << args << "Update: Operation cancelled before start";
} else { else
sdkManagerCommand(m_config.sdkManagerToolPath(), args, m_sdkManager, fi, result, sdkManagerCommand(m_config, args, m_sdkManager, fi, result, progressQuota, isInstall);
progressQuota, isInstall);
}
currentProgress += progressQuota; currentProgress += progressQuota;
fi.setProgressValue(currentProgress); fi.setProgressValue(currentProgress);
if (result.stdError.isEmpty() && !result.success) if (result.stdError.isEmpty() && !result.success)
@@ -869,7 +869,7 @@ void AndroidSdkManagerPrivate::checkPendingLicense(SdkCmdFutureInterface &fi)
result.type = AndroidSdkManager::LicenseCheck; result.type = AndroidSdkManager::LicenseCheck;
QStringList args("--licenses"); QStringList args("--licenses");
if (!fi.isCanceled()) if (!fi.isCanceled())
sdkManagerCommand(m_config.sdkManagerToolPath(), args, m_sdkManager, fi, result, 100.0); sdkManagerCommand(m_config, args, m_sdkManager, fi, result, 100.0);
else else
qCDebug(sdkManagerLog) << "Update: Operation cancelled before start"; qCDebug(sdkManagerLog) << "Update: Operation cancelled before start";
@@ -884,6 +884,7 @@ void AndroidSdkManagerPrivate::getPendingLicense(SdkCmdFutureInterface &fi)
AndroidSdkManager::OperationOutput result; AndroidSdkManager::OperationOutput result;
result.type = AndroidSdkManager::LicenseWorkflow; result.type = AndroidSdkManager::LicenseWorkflow;
QtcProcess licenseCommand; QtcProcess licenseCommand;
licenseCommand.setProcessEnvironment(AndroidConfigurations::toolsEnvironment(m_config));
bool reviewingLicenses = false; bool reviewingLicenses = false;
licenseCommand.setCommand(m_config.sdkManagerToolPath().toString(), {"--licenses"}); licenseCommand.setCommand(m_config.sdkManagerToolPath().toString(), {"--licenses"});
if (Utils::HostOsInfo::isWindowsHost()) if (Utils::HostOsInfo::isWindowsHost())
@@ -987,7 +988,7 @@ void AndroidSdkManagerPrivate::parseCommonArguments(QFutureInterface<QString> &f
{ {
QString argumentDetails; QString argumentDetails;
QString output; QString output;
sdkManagerCommand(m_config.sdkManagerToolPath(), QStringList("--help"), &output); sdkManagerCommand(m_config, QStringList("--help"), &output);
bool foundTag = false; bool foundTag = false;
for (const QString& line : output.split('\n')) { for (const QString& line : output.split('\n')) {
if (fi.isCanceled()) if (fi.isCanceled())

View File

@@ -323,7 +323,6 @@ void AndroidSdkManagerWidget::addPackageFuture(const QFuture<AndroidSdkManager::
QTC_ASSERT(!m_currentOperation, return); QTC_ASSERT(!m_currentOperation, return);
if (!future.isFinished() || !future.isCanceled()) { if (!future.isFinished() || !future.isCanceled()) {
m_currentOperation = new QFutureWatcher<AndroidSdkManager::OperationOutput>; m_currentOperation = new QFutureWatcher<AndroidSdkManager::OperationOutput>;
m_currentOperation->setFuture(future);
connect(m_currentOperation, connect(m_currentOperation,
&QFutureWatcher<AndroidSdkManager::OperationOutput>::resultReadyAt, &QFutureWatcher<AndroidSdkManager::OperationOutput>::resultReadyAt,
this, &AndroidSdkManagerWidget::onOperationResult); this, &AndroidSdkManagerWidget::onOperationResult);
@@ -334,6 +333,7 @@ void AndroidSdkManagerWidget::addPackageFuture(const QFuture<AndroidSdkManager::
[this](int value) { [this](int value) {
m_ui->operationProgress->setValue(value); m_ui->operationProgress->setValue(value);
}); });
m_currentOperation->setFuture(future);
} else { } else {
qCDebug(androidSdkMgrUiLog) << "Operation canceled/finished before adding to the queue"; qCDebug(androidSdkMgrUiLog) << "Operation canceled/finished before adding to the queue";
if (m_sdkManager->isBusy()) { if (m_sdkManager->isBusy()) {

View File

@@ -58,11 +58,11 @@ public:
output. output.
*/ */
static bool androidToolCommand(Utils::FileName toolPath, const QStringList &args, static bool androidToolCommand(Utils::FileName toolPath, const QStringList &args,
const Environment &environment, QString *output) const QProcessEnvironment &environment, QString *output)
{ {
QString androidToolPath = toolPath.toString(); QString androidToolPath = toolPath.toString();
SynchronousProcess proc; SynchronousProcess proc;
proc.setProcessEnvironment(environment.toProcessEnvironment()); proc.setProcessEnvironment(environment);
SynchronousProcessResponse response = proc.runBlocking(androidToolPath, args); SynchronousProcessResponse response = proc.runBlocking(androidToolPath, args);
if (response.result == SynchronousProcessResponse::Finished) { if (response.result == SynchronousProcessResponse::Finished) {
if (output) if (output)
@@ -103,7 +103,7 @@ SdkPlatformList AndroidToolManager::availableSdkPlatforms(bool *ok) const
SdkPlatformList list; SdkPlatformList list;
QString targetListing; QString targetListing;
if (androidToolCommand(m_config.androidToolPath(), QStringList({"list", "target"}), if (androidToolCommand(m_config.androidToolPath(), QStringList({"list", "target"}),
androidToolEnvironment(), &targetListing)) { AndroidConfigurations::toolsEnvironment(m_config), &targetListing)) {
m_parser->parseTargetListing(targetListing, m_config.sdkLocation(), list); m_parser->parseTargetListing(targetListing, m_config.sdkLocation(), list);
success = true; success = true;
} else { } else {
@@ -124,14 +124,15 @@ void AndroidToolManager::launchAvdManager() const
QFuture<CreateAvdInfo> AndroidToolManager::createAvd(CreateAvdInfo info) const QFuture<CreateAvdInfo> AndroidToolManager::createAvd(CreateAvdInfo info) const
{ {
return Utils::runAsync(&AndroidToolManager::createAvdImpl, info, return Utils::runAsync(&AndroidToolManager::createAvdImpl, info,
m_config.androidToolPath(), androidToolEnvironment()); m_config.androidToolPath(),
AndroidConfigurations::toolsEnvironment(m_config));
} }
bool AndroidToolManager::removeAvd(const QString &name) const bool AndroidToolManager::removeAvd(const QString &name) const
{ {
SynchronousProcess proc; SynchronousProcess proc;
proc.setTimeoutS(5); proc.setTimeoutS(5);
proc.setProcessEnvironment(androidToolEnvironment().toProcessEnvironment()); proc.setProcessEnvironment(AndroidConfigurations::toolsEnvironment(m_config));
SynchronousProcessResponse response SynchronousProcessResponse response
= proc.runBlocking(m_config.androidToolPath().toString(), = proc.runBlocking(m_config.androidToolPath().toString(),
QStringList({"delete", "avd", "-n", name})); QStringList({"delete", "avd", "-n", name}));
@@ -142,27 +143,14 @@ QFuture<AndroidDeviceInfoList> AndroidToolManager::androidVirtualDevicesFuture()
{ {
return Utils::runAsync(&AndroidToolManager::androidVirtualDevices, return Utils::runAsync(&AndroidToolManager::androidVirtualDevices,
m_config.androidToolPath(), m_config.sdkLocation(), m_config.androidToolPath(), m_config.sdkLocation(),
androidToolEnvironment()); AndroidConfigurations::toolsEnvironment(m_config));
}
Environment AndroidToolManager::androidToolEnvironment() const
{
Environment env = Environment::systemEnvironment();
Utils::FileName jdkLocation = m_config.openJDKLocation();
if (!jdkLocation.isEmpty()) {
env.set(QLatin1String("JAVA_HOME"), jdkLocation.toUserOutput());
Utils::FileName binPath = jdkLocation;
binPath.appendPath(QLatin1String("bin"));
env.prependOrSetPath(binPath.toUserOutput());
}
return env;
} }
CreateAvdInfo AndroidToolManager::createAvdImpl(CreateAvdInfo info, FileName androidToolPath, CreateAvdInfo AndroidToolManager::createAvdImpl(CreateAvdInfo info, FileName androidToolPath,
Environment env) QProcessEnvironment env)
{ {
QProcess proc; QProcess proc;
proc.setProcessEnvironment(env.toProcessEnvironment()); proc.setProcessEnvironment(env);
QStringList arguments; QStringList arguments;
arguments << QLatin1String("create") << QLatin1String("avd") arguments << QLatin1String("create") << QLatin1String("avd")
<< QLatin1String("-t") << AndroidConfig::apiLevelNameFor(info.sdkPlatform) << QLatin1String("-t") << AndroidConfig::apiLevelNameFor(info.sdkPlatform)
@@ -212,11 +200,11 @@ CreateAvdInfo AndroidToolManager::createAvdImpl(CreateAvdInfo info, FileName and
AndroidDeviceInfoList AndroidToolManager::androidVirtualDevices(const Utils::FileName &androidTool, AndroidDeviceInfoList AndroidToolManager::androidVirtualDevices(const Utils::FileName &androidTool,
const FileName &sdkLocationPath, const FileName &sdkLocationPath,
const Environment &environment) const QProcessEnvironment &env)
{ {
AndroidDeviceInfoList devices; AndroidDeviceInfoList devices;
QString output; QString output;
if (!androidToolCommand(androidTool, QStringList({"list", "avd"}), environment, &output)) if (!androidToolCommand(androidTool, QStringList({"list", "avd"}), env, &output))
return devices; return devices;
QStringList avds = output.split('\n'); QStringList avds = output.split('\n');

View File

@@ -57,12 +57,11 @@ public:
// Helper methods // Helper methods
private: private:
Utils::Environment androidToolEnvironment() const;
static CreateAvdInfo createAvdImpl(CreateAvdInfo info, Utils::FileName androidToolPath, static CreateAvdInfo createAvdImpl(CreateAvdInfo info, Utils::FileName androidToolPath,
Utils::Environment env); QProcessEnvironment env);
static AndroidDeviceInfoList androidVirtualDevices(const Utils::FileName &androidTool, static AndroidDeviceInfoList androidVirtualDevices(const Utils::FileName &androidTool,
const Utils::FileName &sdkLlocationPath, const Utils::FileName &sdkLlocationPath,
const Utils::Environment &environment); const QProcessEnvironment &env);
private: private:
const AndroidConfig &m_config; const AndroidConfig &m_config;
std::unique_ptr<AndroidToolOutputParser> m_parser; std::unique_ptr<AndroidToolOutputParser> m_parser;

View File

@@ -138,10 +138,13 @@ void Uncrustify::formatSelectedText()
if (tc.hasSelection()) { if (tc.hasSelection()) {
// Extend selection to full lines // Extend selection to full lines
const int posSelectionEnd = tc.selectionEnd(); const int posSelectionEnd = tc.selectionEnd();
tc.setPosition(tc.selectionStart());
tc.movePosition(QTextCursor::StartOfLine); tc.movePosition(QTextCursor::StartOfLine);
const int startPos = tc.position(); const int startPos = tc.position();
tc.setPosition(posSelectionEnd); tc.setPosition(posSelectionEnd);
tc.movePosition(QTextCursor::EndOfLine); // Don't extend the selection if the cursor is at the start of the line
if (tc.positionInBlock() > 0)
tc.movePosition(QTextCursor::EndOfLine);
const int endPos = tc.position(); const int endPos = tc.position();
m_beautifierPlugin->formatCurrentFile(command(cfgFileName, true), startPos, endPos); m_beautifierPlugin->formatCurrentFile(command(cfgFileName, true), startPos, endPos);
} else if (m_settings->formatEntireFileFallback()) { } else if (m_settings->formatEntireFileFallback()) {

View File

@@ -1758,7 +1758,8 @@ bool GitClient::cleanList(const QString &workingDirectory, const QString &module
const QString directory = workingDirectory + '/' + modulePath; const QString directory = workingDirectory + '/' + modulePath;
const QStringList arguments = {"clean", "--dry-run", flag}; const QStringList arguments = {"clean", "--dry-run", flag};
const SynchronousProcessResponse resp = vcsFullySynchronousExec(directory, arguments); const SynchronousProcessResponse resp = vcsFullySynchronousExec(directory, arguments,
VcsCommand::ForceCLocale);
if (resp.result != SynchronousProcessResponse::Finished) { if (resp.result != SynchronousProcessResponse::Finished) {
msgCannotRun(arguments, directory, resp.stdErr(), errorMessage); msgCannotRun(arguments, directory, resp.stdErr(), errorMessage);
return false; return false;
@@ -2995,7 +2996,8 @@ bool GitClient::synchronousStashList(const QString &workingDirectory, QList<Stas
stashes->clear(); stashes->clear();
const QStringList arguments = {"stash", "list", noColorOption}; const QStringList arguments = {"stash", "list", noColorOption};
const SynchronousProcessResponse resp = vcsFullySynchronousExec(workingDirectory, arguments); const SynchronousProcessResponse resp = vcsFullySynchronousExec(workingDirectory, arguments,
VcsCommand::ForceCLocale);
if (resp.result != SynchronousProcessResponse::Finished) { if (resp.result != SynchronousProcessResponse::Finished) {
msgCannotRun(arguments, workingDirectory, resp.stdErr(), errorMessage); msgCannotRun(arguments, workingDirectory, resp.stdErr(), errorMessage);
return false; return false;

View File

@@ -54,8 +54,12 @@ bool MergeTool::start(const QString &workingDirectory, const QStringList &files)
{ {
QStringList arguments; QStringList arguments;
arguments << "mergetool" << "-y" << files; arguments << "mergetool" << "-y" << files;
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert("LANG", "C");
env.insert("LANGUAGE", "C");
m_process = new QProcess(this); m_process = new QProcess(this);
m_process->setWorkingDirectory(workingDirectory); m_process->setWorkingDirectory(workingDirectory);
m_process->setProcessEnvironment(env);
const Utils::FileName binary = GitPlugin::client()->vcsBinary(); const Utils::FileName binary = GitPlugin::client()->vcsBinary();
VcsOutputWindow::appendCommand(workingDirectory, binary, arguments); VcsOutputWindow::appendCommand(workingDirectory, binary, arguments);
m_process->start(binary.toString(), arguments); m_process->start(binary.toString(), arguments);

View File

@@ -324,19 +324,26 @@ void FolderNavigationWidget::contextMenuEvent(QContextMenuEvent *ev)
const bool hasCurrentItem = current.isValid(); const bool hasCurrentItem = current.isValid();
QAction *actionOpenFile = nullptr; QAction *actionOpenFile = nullptr;
QAction *actionOpenProjects = nullptr; QAction *actionOpenProjects = nullptr;
QAction *actionOpenAsProject = nullptr;
const Utils::FileName filePath = hasCurrentItem ? Utils::FileName::fromString(
m_fileSystemModel->filePath(current))
: Utils::FileName();
if (hasCurrentItem) { if (hasCurrentItem) {
const QString fileName = m_fileSystemModel->fileName(current); const QString fileName = m_fileSystemModel->fileName(current);
if (m_fileSystemModel->isDir(current)) if (m_fileSystemModel->isDir(current)) {
actionOpenProjects = menu.addAction(tr("Open Project in \"%1\"").arg(fileName)); actionOpenProjects = menu.addAction(tr("Open Project in \"%1\"").arg(fileName));
else } else {
actionOpenFile = menu.addAction(tr("Open \"%1\"").arg(fileName)); actionOpenFile = menu.addAction(tr("Open \"%1\"").arg(fileName));
if (ProjectExplorerPlugin::isProjectFile(Utils::FileName::fromString(fileName)))
actionOpenAsProject = menu.addAction(tr("Open Project \"%1\"").arg(fileName));
}
} }
// we need dummy DocumentModel::Entry with absolute file path in it // we need dummy DocumentModel::Entry with absolute file path in it
// to get EditorManager::addNativeDirAndOpenWithActions() working // to get EditorManager::addNativeDirAndOpenWithActions() working
Core::DocumentModel::Entry fakeEntry; Core::DocumentModel::Entry fakeEntry;
Core::IDocument document; Core::IDocument document;
document.setFilePath(Utils::FileName::fromString(m_fileSystemModel->filePath(current))); document.setFilePath(filePath);
fakeEntry.document = &document; fakeEntry.document = &document;
Core::EditorManager::addNativeDirAndOpenWithActions(&menu, &fakeEntry); Core::EditorManager::addNativeDirAndOpenWithActions(&menu, &fakeEntry);
@@ -347,6 +354,8 @@ void FolderNavigationWidget::contextMenuEvent(QContextMenuEvent *ev)
ev->accept(); ev->accept();
if (action == actionOpenFile) if (action == actionOpenFile)
openItem(current); openItem(current);
else if (action == actionOpenAsProject)
ProjectExplorerPlugin::openProject(filePath.toString());
else if (action == actionOpenProjects) else if (action == actionOpenProjects)
openProjectsInDirectory(current); openProjectsInDirectory(current);
} }

View File

@@ -3530,6 +3530,16 @@ QStringList ProjectExplorerPlugin::projectFilePatterns()
return patterns; return patterns;
} }
bool ProjectExplorerPlugin::isProjectFile(const Utils::FileName &filePath)
{
Utils::MimeType mt = Utils::mimeTypeForFile(filePath.toString());
for (const QString &mime : dd->m_projectCreators.keys()) {
if (mt.inherits(mime))
return true;
}
return false;
}
void ProjectExplorerPlugin::openOpenProjectDialog() void ProjectExplorerPlugin::openOpenProjectDialog()
{ {
const QString path = DocumentManager::useProjectsDirectory() const QString path = DocumentManager::useProjectsDirectory()

View File

@@ -43,7 +43,10 @@ class IMode;
class Id; class Id;
} // namespace Core } // namespace Core
namespace Utils { class ProcessHandle; } namespace Utils {
class ProcessHandle;
class FileName;
}
namespace ProjectExplorer { namespace ProjectExplorer {
class RunControl; class RunControl;
@@ -132,6 +135,7 @@ public:
// internal public for FlatModel // internal public for FlatModel
static void renameFile(Node *node, const QString &newFilePath); static void renameFile(Node *node, const QString &newFilePath);
static QStringList projectFilePatterns(); static QStringList projectFilePatterns();
static bool isProjectFile(const Utils::FileName &filePath);
static QList<QPair<QString, QString> > recentProjects(); static QList<QPair<QString, QString> > recentProjects();
static bool canRunStartupProject(Core::Id runMode, QString *whyNot = nullptr); static bool canRunStartupProject(Core::Id runMode, QString *whyNot = nullptr);

View File

@@ -786,8 +786,10 @@ void VcsBasePlugin::setProcessEnvironment(QProcessEnvironment *e,
bool forceCLocale, bool forceCLocale,
const QString &sshPromptBinary) const QString &sshPromptBinary)
{ {
if (forceCLocale) if (forceCLocale) {
e->insert("LANG", "C"); e->insert("LANG", "C");
e->insert("LANGUAGE", "C");
}
if (!sshPromptBinary.isEmpty()) if (!sshPromptBinary.isEmpty())
e->insert("SSH_ASKPASS", sshPromptBinary); e->insert("SSH_ASKPASS", sshPromptBinary);
} }