Added square brackets [] to banned characters in the profile name.

Fixes "Unable to import config bundle #2236"
This commit is contained in:
bubnikv 2019-05-15 10:59:21 +02:00
parent 6bc6806a2e
commit 44306e17e9

View File

@ -3287,27 +3287,27 @@ void SavePresetWindow::accept()
{ {
m_chosen_name = normalize_utf8_nfc(m_combo->GetValue().ToUTF8()); m_chosen_name = normalize_utf8_nfc(m_combo->GetValue().ToUTF8());
if (!m_chosen_name.empty()) { if (!m_chosen_name.empty()) {
const char* unusable_symbols = "<>:/\\|?*\""; const char* unusable_symbols = "<>[]:/\\|?*\"";
bool is_unusable_symbol = false; bool is_unusable_symbol = false;
bool is_unusable_postfix = false; bool is_unusable_suffix = false;
const std::string unusable_postfix = PresetCollection::get_suffix_modified();//"(modified)"; const std::string unusable_suffix = PresetCollection::get_suffix_modified();//"(modified)";
for (size_t i = 0; i < std::strlen(unusable_symbols); i++) { for (size_t i = 0; i < std::strlen(unusable_symbols); i++) {
if (m_chosen_name.find_first_of(unusable_symbols[i]) != std::string::npos) { if (m_chosen_name.find_first_of(unusable_symbols[i]) != std::string::npos) {
is_unusable_symbol = true; is_unusable_symbol = true;
break; break;
} }
} }
if (m_chosen_name.find(unusable_postfix) != std::string::npos) if (m_chosen_name.find(unusable_suffix) != std::string::npos)
is_unusable_postfix = true; is_unusable_suffix = true;
if (is_unusable_symbol) { if (is_unusable_symbol) {
show_error(this,_(L("The supplied name is not valid;")) + "\n" + show_error(this,_(L("The supplied name is not valid;")) + "\n" +
_(L("the following characters are not allowed:")) + " <>:/\\|?*\""); _(L("the following characters are not allowed:")) + " " + unusable_symbols);
} }
else if (is_unusable_postfix) { else if (is_unusable_suffix) {
show_error(this,_(L("The supplied name is not valid;")) + "\n" + show_error(this,_(L("The supplied name is not valid;")) + "\n" +
_(L("the following postfix are not allowed:")) + "\n\t" + //unusable_postfix); _(L("the following suffix is not allowed:")) + "\n\t" +
wxString::FromUTF8(unusable_postfix.c_str())); wxString::FromUTF8(unusable_suffix.c_str()));
} }
else if (m_chosen_name == "- default -") { else if (m_chosen_name == "- default -") {
show_error(this, _(L("The supplied name is not available."))); show_error(this, _(L("The supplied name is not available.")));