mirror of
https://github.com/veracrypt/VeraCrypt
synced 2024-11-30 15:03:31 +01:00
Linux/MacOSX: Only load valid XML language files (Language.langid.xml format with langid one of the predefined language identifiers)
This commit is contained in:
parent
380ca35c6d
commit
d6f0250901
@ -130,16 +130,25 @@ namespace VeraCrypt
|
|||||||
|
|
||||||
if (wxDir::Exists(languagesFolder.GetName())) {
|
if (wxDir::Exists(languagesFolder.GetName())) {
|
||||||
size_t langCount;
|
size_t langCount;
|
||||||
langCount = wxDir::GetAllFiles(languagesFolder.GetName(), &langArray, wxEmptyString, wxDIR_FILES);
|
langCount = wxDir::GetAllFiles(languagesFolder.GetName(), &langArray, "*.xml", wxDIR_FILES);
|
||||||
for (size_t i = 0; i < langCount; ++i) {
|
for (size_t i = 0; i < langCount; ++i) {
|
||||||
wxFileName filename(langArray[i]);
|
wxFileName filename(langArray[i]);
|
||||||
wxString langId = filename.GetName().AfterLast('.');
|
|
||||||
|
// Get the name part of the file (without extension)
|
||||||
|
wxString basename = filename.GetName();
|
||||||
|
|
||||||
|
// Check if the basename matches the pattern "Language.langId"
|
||||||
|
if (basename.StartsWith("Language.")) {
|
||||||
|
wxString langId = basename.AfterFirst('.');
|
||||||
|
|
||||||
|
// Verify if the language ID exists in langEntries map
|
||||||
wxString langNative = langEntries[langId];
|
wxString langNative = langEntries[langId];
|
||||||
if (!langNative.empty()) {
|
if (!langNative.empty()) {
|
||||||
LanguageListBox->Append(langNative);
|
LanguageListBox->Append(langNative);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user