diff options
author | Tim Schumacher <timschumi@gmx.de> | 2023-02-08 21:08:01 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-02-13 00:50:07 +0000 |
commit | d43a7eae545cd699f301471bd0f82399174339c1 (patch) | |
tree | c0a55f768f845041c3aebed3f126d462155a799f /Userland/DevTools/HackStudio/HackStudioWidget.cpp | |
parent | 14951b92ca6160664ccb68c5e1b2d40133763e5f (diff) | |
download | serenity-d43a7eae545cd699f301471bd0f82399174339c1.zip |
LibCore: Rename `File` to `DeprecatedFile`
As usual, this removes many unused includes and moves used includes
further down the chain.
Diffstat (limited to 'Userland/DevTools/HackStudio/HackStudioWidget.cpp')
-rw-r--r-- | Userland/DevTools/HackStudio/HackStudioWidget.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp index 7cfd771a4c..464baebc50 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp +++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp @@ -27,9 +27,9 @@ #include <AK/StringBuilder.h> #include <Kernel/API/InodeWatcherEvent.h> #include <LibConfig/Client.h> +#include <LibCore/DeprecatedFile.h> #include <LibCore/Event.h> #include <LibCore/EventLoop.h> -#include <LibCore/File.h> #include <LibCore/FileWatcher.h> #include <LibCore/System.h> #include <LibDebug/DebugSession.h> @@ -312,7 +312,7 @@ bool HackStudioWidget::open_file(DeprecatedString const& full_filename, size_t l if (full_filename.starts_with(project().root_path())) { filename = LexicalPath::relative_path(full_filename, project().root_path()); } - if (Core::File::is_directory(filename) || !Core::File::exists(filename)) + if (Core::DeprecatedFile::is_directory(filename) || !Core::DeprecatedFile::exists(filename)) return false; auto editor_wrapper_or_none = m_all_editor_wrappers.first_matching([&](auto& wrapper) { @@ -534,13 +534,13 @@ ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_new_file_action(Dep DeprecatedString filepath; if (!path_to_selected.is_empty()) { - VERIFY(Core::File::exists(path_to_selected.first())); + VERIFY(Core::DeprecatedFile::exists(path_to_selected.first())); LexicalPath selected(path_to_selected.first()); DeprecatedString dir_path; - if (Core::File::is_directory(selected.string())) + if (Core::DeprecatedFile::is_directory(selected.string())) dir_path = selected.string(); else dir_path = selected.dirname(); @@ -574,7 +574,7 @@ ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_new_directory_actio DeprecatedString dir_path; - if (Core::File::is_directory(selected.string())) + if (Core::DeprecatedFile::is_directory(selected.string())) dir_path = selected.string(); else dir_path = selected.dirname(); @@ -682,7 +682,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_delete_action() } bool is_directory = S_ISDIR(st.st_mode); - if (auto result = Core::File::remove(file, Core::File::RecursionMode::Allowed); result.is_error()) { + if (auto result = Core::DeprecatedFile::remove(file, Core::DeprecatedFile::RecursionMode::Allowed); result.is_error()) { auto& error = result.error(); if (is_directory) { GUI::MessageBox::show(window(), @@ -904,7 +904,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_save_as_action() 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(), - Core::File::absolute_path(old_path.dirname())); + Core::DeprecatedFile::absolute_path(old_path.dirname())); if (!save_path.has_value()) { return; } @@ -1001,7 +1001,7 @@ ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_debug_action() { auto icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/debug-run.png"sv)); return GUI::Action::create("&Debug", icon, [this](auto&) { - if (!Core::File::exists(get_project_executable_path())) { + if (!Core::DeprecatedFile::exists(get_project_executable_path())) { GUI::MessageBox::show(window(), DeprecatedString::formatted("Could not find file: {}. (did you build the project?)", get_project_executable_path()), "Error"sv, GUI::MessageBox::Type::Error); return; } @@ -1245,7 +1245,7 @@ void HackStudioWidget::configure_project_tree_view() auto selections = m_project_tree_view->selection().indices(); auto it = selections.find_if([&](auto selected_file) { - return Core::File::can_delete_or_move(m_project->model().full_path(selected_file)); + return Core::DeprecatedFile::can_delete_or_move(m_project->model().full_path(selected_file)); }); bool has_permissions = it != selections.end(); m_tree_view_rename_action->set_enabled(has_permissions); @@ -1779,10 +1779,10 @@ ErrorOr<NonnullRefPtr<GUI::Action>> HackStudioWidget::create_open_project_config DeprecatedString formatted_error_string_holder; auto save_configuration_or_error = [&]() -> ErrorOr<void> { - if (Core::File::exists(absolute_config_file_path)) + if (Core::DeprecatedFile::exists(absolute_config_file_path)) return {}; - if (Core::File::exists(parent_directory) && !Core::File::is_directory(parent_directory)) { + if (Core::DeprecatedFile::exists(parent_directory) && !Core::DeprecatedFile::is_directory(parent_directory)) { formatted_error_string_holder = DeprecatedString::formatted("Cannot create the '{}' directory because there is already a file with that name", parent_directory); return Error::from_string_view(formatted_error_string_holder); } |