1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-08 23:07:35 +00:00

AK+Everywhere: Remove the null state of DeprecatedString

This commit removes DeprecatedString's "null" state, and replaces all
its users with one of the following:
- A normal, empty DeprecatedString
- Optional<DeprecatedString>

Note that null states of DeprecatedFlyString/StringView/etc are *not*
affected by this commit. However, DeprecatedString::empty() is now
considered equal to a null StringView.
This commit is contained in:
Ali Mohammad Pur 2023-10-10 15:00:58 +03:30 committed by Ali Mohammad Pur
parent daf6d8173c
commit aeee98b3a1
189 changed files with 597 additions and 652 deletions

View file

@ -909,15 +909,15 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_save_as_action()
auto suggested_path = FileSystem::absolute_path(old_path.string()).release_value_but_fixme_should_propagate_errors();
Optional<DeprecatedString> save_path = GUI::FilePicker::get_save_filepath(window(),
old_filename.is_null() ? "Untitled"sv : old_path.title(),
old_filename.is_null() ? "txt"sv : old_path.extension(),
old_filename.is_empty() ? "Untitled"sv : old_path.title(),
old_filename.is_empty() ? "txt"sv : old_path.extension(),
suggested_path);
if (!save_path.has_value()) {
return;
}
DeprecatedString const relative_file_path = LexicalPath::relative_path(save_path.value(), m_project->root_path());
if (current_editor_wrapper().filename().is_null()) {
if (current_editor_wrapper().filename().is_empty()) {
current_editor_wrapper().set_filename(relative_file_path);
} else {
for (auto& editor_wrapper : m_all_editor_wrappers) {
@ -1729,7 +1729,7 @@ void HackStudioWidget::update_current_editor_title()
void HackStudioWidget::on_cursor_change()
{
update_statusbar();
if (current_editor_wrapper().filename().is_null())
if (current_editor_wrapper().filename().is_empty())
return;
auto current_location = current_project_location();