MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / get_version

Method get_version

editor/export/editor_export_preset.cpp:552–595  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

550}
551
552String EditorExportPreset::get_version(const StringName &p_preset_string, bool p_windows_version) const {
553 String result = get(p_preset_string);
554 if (result.is_empty()) {
555 result = GLOBAL_GET("application/config/version");
556
557 // Split and validate version number components.
558 const PackedStringArray result_split = result.split(".", false);
559 bool valid_version = !result_split.is_empty();
560 for (const String &E : result_split) {
561 if (!_check_digits(E)) {
562 valid_version = false;
563 break;
564 }
565 }
566
567 if (valid_version) {
568 if (p_windows_version) {
569 // Modify version number to match Windows constraints (version numbers must have 4 components).
570 if (result_split.size() == 1) {
571 result = result + ".0.0.0";
572 } else if (result_split.size() == 2) {
573 result = result + ".0.0";
574 } else if (result_split.size() == 3) {
575 result = result + ".0";
576 } else {
577 result = vformat("%s.%s.%s.%s", result_split[0], result_split[1], result_split[2], result_split[3]);
578 }
579 } else {
580 result = String(".").join(result_split);
581 }
582 } else {
583 if (!result.is_empty()) {
584 WARN_PRINT(vformat("Invalid version number \"%s\". The version number can only contain numeric characters (0-9) and non-consecutive periods (.).", result));
585 }
586 if (p_windows_version) {
587 result = "1.0.0.0";
588 } else {
589 result = "1.0.0";
590 }
591 }
592 }
593
594 return result;
595}

Callers 10

set_history_as_savedMethod · 0.45
is_history_unsavedMethod · 0.45
is_scene_changedMethod · 0.45
ok_pressedMethod · 0.45
is_unsavedMethod · 0.45
is_unsavedMethod · 0.45
is_unsavedMethod · 0.45
_notificationMethod · 0.45
scanMethod · 0.45
_fix_config_fileMethod · 0.45

Calls 8

_check_digitsFunction · 0.85
vformatFunction · 0.85
splitMethod · 0.80
joinMethod · 0.80
sizeMethod · 0.65
getFunction · 0.50
StringClass · 0.50
is_emptyMethod · 0.45

Tested by

no test coverage detected