diff options
-rw-r--r-- | src/libs/utils/environment.cpp | 20 | ||||
-rw-r--r-- | src/libs/utils/environment.h | 3 | ||||
-rw-r--r-- | src/plugins/autotoolsprojectmanager/makestep.cpp | 4 | ||||
-rw-r--r-- | src/plugins/cmakeprojectmanager/cmakebuildstep.cpp | 4 | ||||
-rw-r--r-- | src/plugins/cmakeprojectmanager/cmaketool.cpp | 2 | ||||
-rw-r--r-- | src/plugins/coreplugin/patchtool.cpp | 3 | ||||
-rw-r--r-- | src/plugins/debugger/gdb/coregdbadapter.cpp | 2 | ||||
-rw-r--r-- | src/plugins/genericprojectmanager/genericmakestep.cpp | 4 | ||||
-rw-r--r-- | src/plugins/ios/iosbuildstep.cpp | 4 | ||||
-rw-r--r-- | src/plugins/ios/iosdsymbuildstep.cpp | 4 | ||||
-rw-r--r-- | src/plugins/projectexplorer/gcctoolchain.cpp | 3 | ||||
-rw-r--r-- | src/plugins/qmakeandroidsupport/androidpackageinstallationstep.cpp | 4 | ||||
-rw-r--r-- | src/plugins/qmakeprojectmanager/makestep.cpp | 8 |
13 files changed, 36 insertions, 29 deletions
diff --git a/src/libs/utils/environment.cpp b/src/libs/utils/environment.cpp index eeb7f75925..50c32f9a07 100644 --- a/src/libs/utils/environment.cpp +++ b/src/libs/utils/environment.cpp @@ -212,6 +212,26 @@ Environment Environment::systemEnvironment() return *staticSystemEnvironment(); } +const char lcMessages[] = "LC_MESSAGES"; +const char englishLocale[] = "en_US.utf8"; + +void Environment::setupEnglishOutput(Environment *environment) +{ + environment->set(QLatin1String(lcMessages), QLatin1String(englishLocale)); +} + +void Environment::setupEnglishOutput(QProcessEnvironment *environment) +{ + environment->insert(QLatin1String(lcMessages), QLatin1String(englishLocale)); +} + +void Environment::setupEnglishOutput(QStringList *environment) +{ + Environment env(*environment); + setupEnglishOutput(&env); + *environment = env.toStringList(); +} + void Environment::clear() { m_values.clear(); diff --git a/src/libs/utils/environment.h b/src/libs/utils/environment.h index c7773179e5..78f51bb7f4 100644 --- a/src/libs/utils/environment.h +++ b/src/libs/utils/environment.h @@ -65,6 +65,9 @@ public: explicit Environment(OsType osType = HostOsInfo::hostOs()) : m_osType(osType) {} explicit Environment(const QStringList &env, OsType osType = HostOsInfo::hostOs()); static Environment systemEnvironment(); + static void setupEnglishOutput(Environment *environment); + static void setupEnglishOutput(QProcessEnvironment *environment); + static void setupEnglishOutput(QStringList *environment); QStringList toStringList() const; QProcessEnvironment toProcessEnvironment() const; diff --git a/src/plugins/autotoolsprojectmanager/makestep.cpp b/src/plugins/autotoolsprojectmanager/makestep.cpp index 7759ece867..ba02a2d440 100644 --- a/src/plugins/autotoolsprojectmanager/makestep.cpp +++ b/src/plugins/autotoolsprojectmanager/makestep.cpp @@ -174,9 +174,7 @@ bool MakeStep::init(QList<const BuildStep *> &earlierSteps) ProcessParameters *pp = processParameters(); pp->setMacroExpander(bc->macroExpander()); Utils::Environment env = bc->environment(); - // Force output to english for the parsers. Do this here and not in the toolchain's - // addToEnvironment() to not screw up the users run environment. - env.set(QLatin1String("LC_ALL"), QLatin1String("C")); + Utils::Environment::setupEnglishOutput(&env); pp->setEnvironment(env); pp->setWorkingDirectory(bc->buildDirectory().toString()); pp->setCommand(tc ? tc->makeCommand(bc->environment()) : QLatin1String("make")); diff --git a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp index b4376d86ea..28c0005323 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp @@ -203,9 +203,7 @@ bool CMakeBuildStep::init(QList<const BuildStep *> &earlierSteps) ProcessParameters *pp = processParameters(); pp->setMacroExpander(bc->macroExpander()); Utils::Environment env = bc->environment(); - // Force output to english for the parsers. Do this here and not in the toolchain's - // addToEnvironment() to not screw up the users run environment. - env.set(QLatin1String("LC_ALL"), QLatin1String("C")); + Utils::Environment::setupEnglishOutput(&env); if (!env.value(QLatin1String("NINJA_STATUS")).startsWith(m_ninjaProgressString)) env.set(QLatin1String("NINJA_STATUS"), m_ninjaProgressString + QLatin1String("%o/sec] ")); pp->setEnvironment(env); diff --git a/src/plugins/cmakeprojectmanager/cmaketool.cpp b/src/plugins/cmakeprojectmanager/cmaketool.cpp index 67c421e98e..084110ef22 100644 --- a/src/plugins/cmakeprojectmanager/cmaketool.cpp +++ b/src/plugins/cmakeprojectmanager/cmaketool.cpp @@ -105,7 +105,7 @@ Utils::SynchronousProcessResponse CMakeTool::run(const QString &arg) const cmake.setTimeoutS(1); cmake.setFlags(Utils::SynchronousProcess::UnixTerminalDisabled); Utils::Environment env = Utils::Environment::systemEnvironment(); - env.set(QLatin1String("LC_ALL"), QLatin1String("C")); + Utils::Environment::setupEnglishOutput(&env); cmake.setProcessEnvironment(env.toProcessEnvironment()); cmake.setTimeOutMessageBoxEnabled(false); diff --git a/src/plugins/coreplugin/patchtool.cpp b/src/plugins/coreplugin/patchtool.cpp index 14590c0048..e4364a3219 100644 --- a/src/plugins/coreplugin/patchtool.cpp +++ b/src/plugins/coreplugin/patchtool.cpp @@ -27,6 +27,7 @@ #include "messagemanager.h" #include "icore.h" #include <utils/synchronousprocess.h> +#include <utils/environment.h> #include <QProcess> #include <QProcessEnvironment> @@ -91,7 +92,7 @@ static bool runPatchHelper(const QByteArray &input, const QString &workingDirect if (!workingDirectory.isEmpty()) patchProcess.setWorkingDirectory(workingDirectory); QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); - env.insert(QLatin1String("LC_ALL"), QLatin1String("C")); + Utils::Environment::setupEnglishOutput(&env); patchProcess.setProcessEnvironment(env); QStringList args; // Add argument 'apply' when git is used as patch command since git 2.5/Windows diff --git a/src/plugins/debugger/gdb/coregdbadapter.cpp b/src/plugins/debugger/gdb/coregdbadapter.cpp index fc6871c703..19868da077 100644 --- a/src/plugins/debugger/gdb/coregdbadapter.cpp +++ b/src/plugins/debugger/gdb/coregdbadapter.cpp @@ -137,7 +137,7 @@ GdbCoreEngine::readExecutableNameFromCore(const QString &debuggerCommand, const QProcess proc; QStringList envLang = QProcess::systemEnvironment(); - envLang.replaceInStrings(QRegExp(QLatin1String("^LC_ALL=.*")), QLatin1String("LC_ALL=C")); + Utils::Environment::setupEnglishOutput(&envLang); proc.setEnvironment(envLang); proc.start(debuggerCommand, args); diff --git a/src/plugins/genericprojectmanager/genericmakestep.cpp b/src/plugins/genericprojectmanager/genericmakestep.cpp index e7076baf2b..f696359bf0 100644 --- a/src/plugins/genericprojectmanager/genericmakestep.cpp +++ b/src/plugins/genericprojectmanager/genericmakestep.cpp @@ -108,9 +108,7 @@ bool GenericMakeStep::init(QList<const BuildStep *> &earlierSteps) pp->setMacroExpander(bc->macroExpander()); pp->setWorkingDirectory(bc->buildDirectory().toString()); Utils::Environment env = bc->environment(); - // Force output to english for the parsers. Do this here and not in the toolchain's - // addToEnvironment() to not screw up the users run environment. - env.set(QLatin1String("LC_ALL"), QLatin1String("C")); + Utils::Environment::setupEnglishOutput(&env); pp->setEnvironment(env); pp->setCommand(makeCommand(bc->environment())); pp->setArguments(allArguments()); diff --git a/src/plugins/ios/iosbuildstep.cpp b/src/plugins/ios/iosbuildstep.cpp index 1d1234c8c5..ccc7fbb799 100644 --- a/src/plugins/ios/iosbuildstep.cpp +++ b/src/plugins/ios/iosbuildstep.cpp @@ -111,9 +111,7 @@ bool IosBuildStep::init(QList<const BuildStep *> &earlierSteps) pp->setMacroExpander(bc->macroExpander()); pp->setWorkingDirectory(bc->buildDirectory().toString()); Utils::Environment env = bc->environment(); - // Force output to english for the parsers. Do this here and not in the toolchain's - // addToEnvironment() to not screw up the users run environment. - env.set(QLatin1String("LC_ALL"), QLatin1String("C")); + Utils::Environment::setupEnglishOutput(&env); pp->setEnvironment(env); pp->setCommand(buildCommand()); pp->setArguments(Utils::QtcProcess::joinArgs(allArguments())); diff --git a/src/plugins/ios/iosdsymbuildstep.cpp b/src/plugins/ios/iosdsymbuildstep.cpp index 4f311061e6..21b726e007 100644 --- a/src/plugins/ios/iosdsymbuildstep.cpp +++ b/src/plugins/ios/iosdsymbuildstep.cpp @@ -90,9 +90,7 @@ bool IosPresetBuildStep::init(QList<const BuildStep *> &earlierSteps) pp->setMacroExpander(bc->macroExpander()); pp->setWorkingDirectory(bc->buildDirectory().toString()); Utils::Environment env = bc->environment(); - // Force output to english for the parsers. Do this here and not in the toolchain's - // addToEnvironment() to not screw up the users run environment. - env.set(QLatin1String("LC_ALL"), QLatin1String("C")); + Utils::Environment::setupEnglishOutput(&env); pp->setEnvironment(env); pp->setCommand(command()); pp->setArguments(Utils::QtcProcess::joinArgs(arguments())); diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index b65ee82776..6853c9e41e 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -71,9 +71,8 @@ static QByteArray runGcc(const FileName &gcc, const QStringList &arguments, cons return QByteArray(); QProcess cpp; - // Force locale: This function is used only to detect settings inside the tool chain, so this is save. QStringList environment(env); - environment.append(QLatin1String("LC_ALL=C")); + Utils::Environment::setupEnglishOutput(&environment); cpp.setEnvironment(environment); cpp.start(gcc.toString(), arguments); diff --git a/src/plugins/qmakeandroidsupport/androidpackageinstallationstep.cpp b/src/plugins/qmakeandroidsupport/androidpackageinstallationstep.cpp index 6630152efb..8dc02fc3ef 100644 --- a/src/plugins/qmakeandroidsupport/androidpackageinstallationstep.cpp +++ b/src/plugins/qmakeandroidsupport/androidpackageinstallationstep.cpp @@ -71,9 +71,7 @@ bool AndroidPackageInstallationStep::init(QList<const BuildStep *> &earlierSteps pp->setWorkingDirectory(bc->buildDirectory().toString()); pp->setCommand(tc->makeCommand(bc->environment())); Utils::Environment env = bc->environment(); - // Force output to english for the parsers. Do this here and not in the toolchain's - // addToEnvironment() to not screw up the users run environment. - env.set(QLatin1String("LC_ALL"), QLatin1String("C")); + Utils::Environment::setupEnglishOutput(&env); pp->setEnvironment(env); const QString innerQuoted = Utils::QtcProcess::quoteArg(dirPath); const QString outerQuoted = Utils::QtcProcess::quoteArg(QString::fromLatin1("INSTALL_ROOT=") + innerQuoted); diff --git a/src/plugins/qmakeprojectmanager/makestep.cpp b/src/plugins/qmakeprojectmanager/makestep.cpp index afcca92053..c23d90b16a 100644 --- a/src/plugins/qmakeprojectmanager/makestep.cpp +++ b/src/plugins/qmakeprojectmanager/makestep.cpp @@ -233,9 +233,7 @@ bool MakeStep::init(QList<const BuildStep *> &earlierSteps) Utils::QtcProcess::addArg(&args, objectFile); } Utils::Environment env = bc->environment(); - // Force output to english for the parsers. Do this here and not in the toolchain's - // addToEnvironment() to not screw up the users run environment. - env.set(QLatin1String("LC_ALL"), QLatin1String("C")); + Utils::Environment::setupEnglishOutput(&env); // We also prepend "L" to the MAKEFLAGS, so that nmake / jom are less verbose if (tc && m_makeCmd.isEmpty()) { if (tc->targetAbi().os() == Abi::WindowsOS @@ -415,9 +413,7 @@ void MakeStepConfigWidget::updateDetails() QString args = m_makeStep->userArguments(); Utils::Environment env = bc->environment(); - // Force output to english for the parsers. Do this here and not in the toolchain's - // addToEnvironment() to not screw up the users run environment. - env.set(QLatin1String("LC_ALL"), QLatin1String("C")); + Utils::Environment::setupEnglishOutput(&env); // We prepend "L" to the MAKEFLAGS, so that nmake / jom are less verbose // FIXME doing this without the user having a way to override this is rather bad if (tc && m_makeStep->makeCommand().isEmpty()) { |