diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-06-16 13:53:57 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-06-16 17:33:30 +0200 |
commit | 5244a49b92fa5acfa7445292775edf61bde6b232 (patch) | |
tree | 0200f36197ed9ef30ca99ffea0eba9eb1e2ff8a1 /onlineupdate/source | |
parent | ebeb76f00e094abe4ca023e29471a3711a022451 (diff) |
updater: find all the language update files
Change-Id: I5261d8d96f83b8b81b0dc2576cbd9241705ae9b7
Diffstat (limited to 'onlineupdate/source')
-rw-r--r-- | onlineupdate/source/update/updater/updater.cxx | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/onlineupdate/source/update/updater/updater.cxx b/onlineupdate/source/update/updater/updater.cxx index b3de68a80f6f..26f0b5df943d 100644 --- a/onlineupdate/source/update/updater/updater.cxx +++ b/onlineupdate/source/update/updater/updater.cxx @@ -2556,13 +2556,39 @@ static int GetUpdateFileNames(std::vector<tstring> fileNames) { NS_tchar fileName[MAXPATHLEN]; - // TODO: moggi: needs adaption for LibreOffice - // We would like to store the name inside of an ini file NS_tsnprintf(fileName, MAXPATHLEN, NS_T("%s/update.mar"), gPatchDirPath); fileNames.push_back(fileName); // add the language packs + NS_tDIR* dir = NS_topendir(gPatchDirPath); + if (!dir) + { + LOG(("Could not open directory " LOG_S, gPatchDirPath)); + return READ_ERROR; + } + + NS_tdirent* entry; + while ((entry = NS_treaddir(dir)) != nullptr) + { + if (NS_tstrcmp(entry->d_name, NS_T(".")) && + NS_tstrcmp(entry->d_name, NS_T(".."))) + { + if (NS_tstrncmp(entry->d_name, NS_T("update"), 6) == 0) + { + char *dot = strrchr(entry->d_name, '.'); + if (dot && !strcmp(dot, ".mar")) + { + NS_tchar updatePath[MAXPATHLEN]; + NS_tsnprintf(updatePath, sizeof(updatePath)/sizeof(updatePath[0]), + NS_T("%s/%s"), gPatchDirPath, entry->d_name); + + LOG (("Found language update file: " LOG_S, updatePath)); + fileNames.push_back(updatePath); + } + } + } + } return OK; } |