mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-14 07:19:31 +00:00
validate addon name when first entered as well
This commit is contained in:
parent
b4f988a220
commit
07100d0759
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include "editor/controller/editor_controller.hpp"
|
#include "editor/controller/editor_controller.hpp"
|
||||||
|
|
||||||
|
#include "addon/validation.hpp"
|
||||||
#include "gettext.hpp"
|
#include "gettext.hpp"
|
||||||
#include "gui/dialogs/editor/choose_addon.hpp"
|
#include "gui/dialogs/editor/choose_addon.hpp"
|
||||||
#include "gui/dialogs/prompt.hpp"
|
#include "gui/dialogs/prompt.hpp"
|
||||||
@ -45,8 +46,7 @@ std::string initialize_addon()
|
|||||||
std::int64_t current_millis = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
|
std::int64_t current_millis = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
|
||||||
addon_id = "MyAwesomeAddon-"+std::to_string(current_millis);
|
addon_id = "MyAwesomeAddon-"+std::to_string(current_millis);
|
||||||
if (gui2::dialogs::prompt::execute(addon_id_new)) {
|
if (gui2::dialogs::prompt::execute(addon_id_new)) {
|
||||||
/* In case somebody enters a blank id and presses OK */
|
addon_id = !addon_filename_legal(addon_id_new) ? "MyAwesomeAddon-"+std::to_string(current_millis) : addon_id_new;
|
||||||
addon_id = addon_id_new.empty() ? "MyAwesomeAddon-"+std::to_string(current_millis) : addon_id_new;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user