mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:37:36 +00:00
Applications: Convert DeprecatedFile
usages to LibFileSystem
This commit is contained in:
parent
5ba7449342
commit
1dc3ba6ed5
14 changed files with 36 additions and 40 deletions
|
@ -11,7 +11,6 @@
|
|||
#include <AK/NumberFormat.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibConfig/Client.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/MimeData.h>
|
||||
#include <LibCore/StandardPaths.h>
|
||||
#include <LibFileSystem/FileSystem.h>
|
||||
|
@ -406,18 +405,21 @@ void DirectoryView::add_path_to_history(DeprecatedString path)
|
|||
|
||||
bool DirectoryView::open(DeprecatedString const& path)
|
||||
{
|
||||
auto real_path = Core::DeprecatedFile::real_path_for(path);
|
||||
if (real_path.is_null() || !FileSystem::is_directory(path))
|
||||
auto error_or_real_path = FileSystem::real_path(path);
|
||||
if (error_or_real_path.is_error() || !FileSystem::is_directory(path))
|
||||
return false;
|
||||
|
||||
if (chdir(real_path.characters()) < 0) {
|
||||
auto real_path = error_or_real_path.release_value();
|
||||
if (Core::System::chdir(real_path).is_error()) {
|
||||
perror("chdir");
|
||||
return false;
|
||||
}
|
||||
if (model().root_path() == real_path) {
|
||||
|
||||
if (model().root_path() == real_path.to_deprecated_string()) {
|
||||
refresh();
|
||||
} else {
|
||||
set_active_widget(¤t_view());
|
||||
model().set_root_path(real_path);
|
||||
model().set_root_path(real_path.to_deprecated_string());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include <AK/NumberFormat.h>
|
||||
#include <Applications/FileManager/DirectoryView.h>
|
||||
#include <Applications/FileManager/PropertiesWindowGeneralTabGML.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/Directory.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibDesktop/Launcher.h>
|
||||
|
@ -102,11 +101,11 @@ ErrorOr<void> PropertiesWindow::create_widgets(bool disable_rename)
|
|||
type->set_text(get_description(m_mode));
|
||||
|
||||
if (S_ISLNK(m_mode)) {
|
||||
auto link_destination_or_error = Core::DeprecatedFile::read_link(m_path);
|
||||
auto link_destination_or_error = FileSystem::read_link(m_path);
|
||||
if (link_destination_or_error.is_error()) {
|
||||
perror("readlink");
|
||||
} else {
|
||||
auto link_destination = link_destination_or_error.release_value();
|
||||
auto link_destination = link_destination_or_error.release_value().to_deprecated_string();
|
||||
auto* link_location = general_tab->find_descendant_of_type_named<GUI::LinkLabel>("link_location");
|
||||
link_location->set_text(link_destination);
|
||||
link_location->on_click = [link_destination] {
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include <LibConfig/Client.h>
|
||||
#include <LibConfig/Listener.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/Process.h>
|
||||
#include <LibCore/StandardPaths.h>
|
||||
#include <LibCore/System.h>
|
||||
|
@ -109,8 +108,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
LexicalPath path(initial_location);
|
||||
if (!initial_location.is_empty()) {
|
||||
if (!ignore_path_resolution)
|
||||
initial_location = Core::DeprecatedFile::real_path_for(initial_location);
|
||||
if (auto error_or_path = FileSystem::real_path(initial_location); !ignore_path_resolution && !error_or_path.is_error())
|
||||
initial_location = error_or_path.release_value().to_deprecated_string();
|
||||
|
||||
if (!FileSystem::is_directory(initial_location)) {
|
||||
// We want to extract zips to a temporary directory when FileManager is launched with a .zip file as its first argument
|
||||
|
@ -142,8 +141,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
}
|
||||
|
||||
if (initial_location.is_empty())
|
||||
initial_location = Core::DeprecatedFile::current_working_directory();
|
||||
if (auto error_or_cwd = FileSystem::current_working_directory(); initial_location.is_empty() && !error_or_cwd.is_error())
|
||||
initial_location = error_or_cwd.release_value().to_deprecated_string();
|
||||
|
||||
if (initial_location.is_empty())
|
||||
initial_location = Core::StandardPaths::home_directory();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue