1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:27:45 +00:00

Everywhere: Rename {Deprecated => Byte}String

This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
Ali Mohammad Pur 2023-12-16 17:49:34 +03:30 committed by Ali Mohammad Pur
parent 38d62563b3
commit 5e1499d104
1615 changed files with 10257 additions and 10257 deletions

View file

@ -28,7 +28,7 @@
RunWindow::RunWindow()
: m_path_history()
, m_path_history_model(GUI::ItemListModel<DeprecatedString>::create(m_path_history))
, m_path_history_model(GUI::ItemListModel<ByteString>::create(m_path_history))
{
// FIXME: Handle failure to load history somehow.
(void)load_history();
@ -65,7 +65,7 @@ RunWindow::RunWindow()
m_browse_button = *find_descendant_of_type_named<GUI::DialogButton>("browse_button");
m_browse_button->on_click = [this](auto) {
Optional<DeprecatedString> path = GUI::FilePicker::get_open_filepath(this, {}, Core::StandardPaths::home_directory(), false, GUI::Dialog::ScreenPosition::Center);
Optional<ByteString> path = GUI::FilePicker::get_open_filepath(this, {}, Core::StandardPaths::home_directory(), false, GUI::Dialog::ScreenPosition::Center);
if (path.has_value())
m_path_combo_box->set_text(path.value().view());
};
@ -95,7 +95,7 @@ void RunWindow::do_run()
if (run_via_launch(run_input) || run_as_command(run_input)) {
// Remove any existing history entry, prepend the successful run string to history and save.
m_path_history.remove_all_matching([&](DeprecatedString v) { return v == run_input; });
m_path_history.remove_all_matching([&](ByteString v) { return v == run_input; });
m_path_history.prepend(run_input);
// FIXME: Handle failure to save history somehow.
(void)save_history();
@ -109,7 +109,7 @@ void RunWindow::do_run()
show();
}
bool RunWindow::run_as_command(DeprecatedString const& run_input)
bool RunWindow::run_as_command(ByteString const& run_input)
{
// TODO: Query and use the user's preferred shell.
auto maybe_child_pid = Core::Process::spawn("/bin/Shell"sv, Array { "-c", run_input.characters() }, {}, Core::Process::KeepAsChild::Yes);
@ -136,7 +136,7 @@ bool RunWindow::run_as_command(DeprecatedString const& run_input)
return true;
}
bool RunWindow::run_via_launch(DeprecatedString const& run_input)
bool RunWindow::run_via_launch(ByteString const& run_input)
{
auto url = URL::create_with_url_or_path(run_input);
@ -147,7 +147,7 @@ bool RunWindow::run_via_launch(DeprecatedString const& run_input)
warnln("Failed to launch '{}': {}", file_path, real_path_or_error.error());
return false;
}
url = URL::create_with_url_or_path(real_path_or_error.release_value().to_deprecated_string());
url = URL::create_with_url_or_path(real_path_or_error.release_value().to_byte_string());
}
if (!Desktop::Launcher::open(url)) {
@ -160,9 +160,9 @@ bool RunWindow::run_via_launch(DeprecatedString const& run_input)
return true;
}
DeprecatedString RunWindow::history_file_path()
ByteString RunWindow::history_file_path()
{
return LexicalPath::canonicalized_path(DeprecatedString::formatted("{}/{}", Core::StandardPaths::config_directory(), "RunHistory.txt"));
return LexicalPath::canonicalized_path(ByteString::formatted("{}/{}", Core::StandardPaths::config_directory(), "RunHistory.txt"));
}
ErrorOr<void> RunWindow::load_history()
@ -186,7 +186,7 @@ ErrorOr<void> RunWindow::save_history()
// Write the first 25 items of history
for (int i = 0; i < min(static_cast<int>(m_path_history.size()), 25); i++)
TRY(file->write_until_depleted(DeprecatedString::formatted("{}\n", m_path_history[i]).bytes()));
TRY(file->write_until_depleted(ByteString::formatted("{}\n", m_path_history[i]).bytes()));
return {};
}