summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-06-14 18:04:09 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-06-16 17:33:30 +0200
commitfc26bbc05e8a3afdffb660d5ea8562afd53918ff (patch)
tree1ac0f1c773b10314ba1cd882be07adb98b929441 /desktop
parent13bb5a4b09f5b2ad19dad1b55f45d0fe2b2fb908 (diff)
updater: only download language packs for installed languages
Change-Id: I8c605e2c64fee4d369732f783cc9dd76f7dc858c
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/app/updater.cxx17
1 files changed, 15 insertions, 2 deletions
diff --git a/desktop/source/app/updater.cxx b/desktop/source/app/updater.cxx
index fbb48d137811..949ec186d1fe 100644
--- a/desktop/source/app/updater.cxx
+++ b/desktop/source/app/updater.cxx
@@ -33,6 +33,12 @@
#include <orcus/pstring.hpp>
#include <comphelper/hash.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+
+#include <officecfg/Setup.hxx>
+
+#include <set>
+
namespace {
class error_updater : public std::exception
@@ -626,6 +632,7 @@ void update_checker()
std::string response_body = download_content(aURL, false, aHash);
if (!response_body.empty())
{
+
update_info aUpdateInfo = parse_response(response_body);
if (aUpdateInfo.aUpdateFile.aURL.isEmpty())
{
@@ -636,11 +643,17 @@ void update_checker()
}
else
{
+ css::uno::Sequence<OUString> aInstalledLanguages(officecfg::Setup::Office::InstalledLocales::get()->getElementNames());
+ std::set<OUString> aInstalledLanguageSet(std::begin(aInstalledLanguages), std::end(aInstalledLanguages));
download_file(aUpdateInfo.aUpdateFile.aURL, aUpdateInfo.aUpdateFile.nSize, aUpdateInfo.aUpdateFile.aHash, "update.mar");
for (auto& lang_update : aUpdateInfo.aLanguageFiles)
{
- OUString aFileName = "update_" + lang_update.aLangCode + ".mar";
- download_file(lang_update.aUpdateFile.aURL, lang_update.aUpdateFile.nSize, lang_update.aUpdateFile.aHash, aFileName);
+ // only download the language packs for installed languages
+ if (aInstalledLanguageSet.find(lang_update.aLangCode) != aInstalledLanguageSet.end())
+ {
+ OUString aFileName = "update_" + lang_update.aLangCode + ".mar";
+ download_file(lang_update.aUpdateFile.aURL, lang_update.aUpdateFile.nSize, lang_update.aUpdateFile.aHash, aFileName);
+ }
}
CreateValidUpdateDir(aUpdateInfo);
}