Repository: godotengine/godot
File: editor/editor_node.cpp (C++)

Code before:

void EditorNode::_editor_file_dialog_register(EditorFileDialog *p_dialog) {
	singleton->editor_file_dialogs.insert(p_dialog);
}

void EditorNode::_editor_file_dialog_unregister(EditorFileDialog *p_dialog) {
	singleton->editor_file_dialogs.erase(p_dialog);
}

Vector<EditorNodeInitCallback> EditorNode::_init_callbacks;

void EditorNode::_begin_first_scan() {
	OS::get_singleton()->benchmark_begin_measure("editor_scan_and_import");
	EditorFileSystem::get_singleton()->scan();
}

Error EditorNode::export_preset(const String &p_preset, const String &p_path, bool p_debug, bool p_pack_only) {
	export_defer.preset = p_preset;
	export_defer.path = p_path;
	export_defer.debug = p_debug;
	export_defer.pack_only = p_pack_only;
	cmdline_export_mode = true;
	return OK;
}

void EditorNode::show_accept(const String &p_text, const String &p_title) {
	current_menu_option = -1;
	if (accept) {
		accept->set_ok_button_text(p_title);
		accept->set_text(p_text);
		EditorInterface::get_singleton()->popup_dialog_centered(accept);
	}
}

void EditorNode::show_save_accept(const String &p_text, const String &p_title) {
	current_menu_option = -1;
	if (save_accept) {
		save_accept->set_ok_button_text(p_title);
		save_accept->set_text(p_text);
		EditorInterface::get_singleton()->popup_dialog_centered(save_accept);
	}
}

void EditorNode::show_warning(const String &p_text, const String &p_title) {
	if (warning) {
		warning->set_text(p_text);
		warning->set_title(p_title);
		EditorInterface::get_singleton()->popup_dialog_centered(warning);
	} else {
		WARN_PRINT(p_title + " " + p_text);
	}

Review comment (suggestion):
This is equivalent to:
```
return String("\n").join(info);
```


Code after:
	info.push_back(vformat("%s Rendering Driver: %s", prefix, driver_name));
	info.push_back(vformat("%s Rendering Method: %s", prefix, rendering_method));
	if (device_type_string.is_empty()) {
		info.push_back(vformat("%s Graphics Card: %s", prefix, rendering_device_name));
	} else {
		info.push_back(vformat("%s Graphics Card: %s (%s)", prefix, rendering_device_name, device_type_string));
	}
	if (video_adapter_driver_info.size() == 2) { // This vector is always either of length 0 or 2.
		String vad_name = video_adapter_driver_info[0];
		String vad_version = video_adapter_driver_info[1]; // Version could be potentially empty on Linux/BSD.
		if (!vad_version.is_empty()) {
			info.push_back(vformat("%s Graphics Card Driver: %s, version %s", prefix, vad_name, vad_version));
		} else {
			info.push_back(vformat("%s Graphics Card Driver: %s", prefix, vad_name));
		}
	}
	info.push_back(vformat("%s CPU: %s (%d Threads)", prefix, processor_name, processor_count));

	return String("\n").join(info);
}

Ref<Texture2D> EditorNode::_file_dialog_get_icon(const String &p_path) {
	EditorFileSystemDirectory *efsd = EditorFileSystem::get_singleton()->get_filesystem_path(p_path.get_base_dir());
	if (efsd) {
		String file = p_path.get_file();
		for (int i = 0; i < efsd->get_file_count(); i++) {
			if (efsd->get_file(i) == file) {
				String type = efsd->get_file_type(i);

				if (singleton->icon_type_cache.has(type)) {
					return singleton->icon_type_cache[type];
				} else {
					return singleton->icon_type_cache["Object"];
				}
			}
		}
	}

	return singleton->icon_type_cache["Object"];
}

void EditorNode::_build_icon_type_cache() {
	List<StringName> tl;
	theme_base->get_theme()->get_icon_list(SNAME("EditorIcons"), &tl);
	for (const StringName &E : tl) {
		if (!ClassDB::class_exists(E)) {
			continue;
		}
		icon_type_cache[E] = theme_base->get_theme()->get_icon(E, SNAME("EditorIcons"));
	}
}