mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 16:27:36 +00:00
LibCore: Rename File
to DeprecatedFile
As usual, this removes many unused includes and moves used includes further down the chain.
This commit is contained in:
parent
14951b92ca
commit
d43a7eae54
193 changed files with 536 additions and 556 deletions
|
@ -13,6 +13,7 @@
|
|||
#include <AudioServer/ConnectionFromClient.h>
|
||||
#include <AudioServer/Mixer.h>
|
||||
#include <LibCore/ConfigFile.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/Timer.h>
|
||||
#include <pthread.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
@ -21,7 +22,7 @@ namespace AudioServer {
|
|||
|
||||
Mixer::Mixer(NonnullRefPtr<Core::ConfigFile> config)
|
||||
// FIXME: Allow AudioServer to use other audio channels as well
|
||||
: m_device(Core::File::construct("/dev/audio/0", this))
|
||||
: m_device(Core::DeprecatedFile::construct("/dev/audio/0", this))
|
||||
, m_sound_thread(Threading::Thread::construct(
|
||||
[this] {
|
||||
mix();
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include <AK/RefCounted.h>
|
||||
#include <AK/WeakPtr.h>
|
||||
#include <LibAudio/Queue.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/Timer.h>
|
||||
#include <LibThreading/ConditionVariable.h>
|
||||
#include <LibThreading/Mutex.h>
|
||||
|
@ -129,7 +128,7 @@ private:
|
|||
Threading::Mutex m_pending_mutex;
|
||||
Threading::ConditionVariable m_mixing_necessary { m_pending_mutex };
|
||||
|
||||
RefPtr<Core::File> m_device;
|
||||
RefPtr<Core::DeprecatedFile> m_device;
|
||||
|
||||
NonnullRefPtr<Threading::Thread> m_sound_thread;
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "ChessEngine.h"
|
||||
#include "MCTSTree.h"
|
||||
#include <AK/Random.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/ElapsedTimer.h>
|
||||
|
||||
using namespace Chess::UCI;
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*/
|
||||
|
||||
#include "ChessEngine.h"
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
||||
|
@ -16,6 +16,6 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
Core::EventLoop loop;
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
auto engine = TRY(ChessEngine::try_create(Core::File::standard_input(), Core::File::standard_output()));
|
||||
auto engine = TRY(ChessEngine::try_create(Core::DeprecatedFile::standard_input(), Core::DeprecatedFile::standard_output()));
|
||||
return loop.exec();
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include <AK/Random.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <AK/Try.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/Timer.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -179,7 +179,7 @@ void DHCPv4Client::try_discover_ifs()
|
|||
|
||||
ErrorOr<DHCPv4Client::Interfaces> DHCPv4Client::get_discoverable_interfaces()
|
||||
{
|
||||
auto file = TRY(Core::File::open("/sys/kernel/net/adapters", Core::OpenMode::ReadOnly));
|
||||
auto file = TRY(Core::DeprecatedFile::open("/sys/kernel/net/adapters", Core::OpenMode::ReadOnly));
|
||||
|
||||
auto file_contents = file->read_all();
|
||||
auto json = JsonValue::from_string(file_contents);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <FileSystemAccessServer/ConnectionFromClient.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/ConnectionToWindowServer.h>
|
||||
|
@ -67,7 +67,7 @@ void ConnectionFromClient::request_file_handler(i32 request_id, i32 window_serve
|
|||
|
||||
auto pid = this->socket().peer_pid().release_value_but_fixme_should_propagate_errors();
|
||||
auto exe_link = LexicalPath("/proc").append(DeprecatedString::number(pid)).append("exe"sv).string();
|
||||
auto exe_path = Core::File::real_path_for(exe_link);
|
||||
auto exe_path = Core::DeprecatedFile::real_path_for(exe_link);
|
||||
|
||||
auto main_window = create_dummy_child_window(window_server_client_id, parent_window_id);
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <LibCore/ConfigFile.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <errno.h>
|
||||
|
@ -38,7 +38,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
}
|
||||
|
||||
bool enable_num_lock = keyboard_settings_config->read_bool_entry("StartupEnable", "NumLock", true);
|
||||
auto keyboard_device = TRY(Core::File::open("/dev/input/keyboard/0", Core::OpenMode::ReadOnly));
|
||||
auto keyboard_device = TRY(Core::DeprecatedFile::open("/dev/input/keyboard/0", Core::OpenMode::ReadOnly));
|
||||
TRY(Core::System::ioctl(keyboard_device->fd(), KEYBOARD_IOCTL_SET_NUM_LOCK, enable_num_lock));
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <AK/LexicalPath.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibCore/ConfigFile.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/MimeData.h>
|
||||
#include <LibCore/Process.h>
|
||||
#include <LibDesktop/AppFile.h>
|
||||
|
@ -179,7 +179,7 @@ Vector<DeprecatedString> Launcher::handlers_with_details_for_url(const URL& url)
|
|||
|
||||
Optional<DeprecatedString> Launcher::mime_type_for_file(DeprecatedString path)
|
||||
{
|
||||
auto file_or_error = Core::File::open(path, Core::OpenMode::ReadOnly);
|
||||
auto file_or_error = Core::DeprecatedFile::open(path, Core::OpenMode::ReadOnly);
|
||||
if (file_or_error.is_error()) {
|
||||
return {};
|
||||
} else {
|
||||
|
@ -308,7 +308,7 @@ void Launcher::for_each_handler_for_path(DeprecatedString const& path, Function<
|
|||
return;
|
||||
|
||||
if (S_ISLNK(st.st_mode)) {
|
||||
auto link_target_or_error = Core::File::read_link(path);
|
||||
auto link_target_or_error = Core::DeprecatedFile::read_link(path);
|
||||
if (link_target_or_error.is_error()) {
|
||||
perror("read_link");
|
||||
return;
|
||||
|
@ -316,7 +316,7 @@ void Launcher::for_each_handler_for_path(DeprecatedString const& path, Function<
|
|||
|
||||
auto link_target = LexicalPath { link_target_or_error.release_value() };
|
||||
LexicalPath absolute_link_target = link_target.is_absolute() ? link_target : LexicalPath::join(LexicalPath::dirname(path), link_target.string());
|
||||
auto real_path = Core::File::real_path_for(absolute_link_target.string());
|
||||
auto real_path = Core::DeprecatedFile::real_path_for(absolute_link_target.string());
|
||||
return for_each_handler_for_path(real_path, [&](auto const& handler) -> bool {
|
||||
return f(handler);
|
||||
});
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <AK/Random.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibCore/ConfigFile.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/LocalServer.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibDNS/Packet.h>
|
||||
|
@ -83,7 +83,7 @@ void LookupServer::load_etc_hosts()
|
|||
m_etc_hosts.ensure(name).empend(name, record_type, RecordClass::IN, s_static_ttl, move(data), false);
|
||||
};
|
||||
|
||||
auto file = Core::File::construct("/etc/hosts");
|
||||
auto file = Core::DeprecatedFile::construct("/etc/hosts");
|
||||
if (!file->open(Core::OpenMode::ReadOnly)) {
|
||||
dbgln("Failed to open '/etc/hosts'");
|
||||
return;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <AK/JsonArray.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/JsonValue.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <limits.h>
|
||||
#include <poll.h>
|
||||
|
@ -119,7 +119,7 @@ ErrorOr<size_t> MulticastDNS::emit_packet(Packet const& packet, sockaddr_in cons
|
|||
|
||||
Vector<IPv4Address> MulticastDNS::local_addresses() const
|
||||
{
|
||||
auto file = Core::File::construct("/sys/kernel/net/adapters");
|
||||
auto file = Core::DeprecatedFile::construct("/sys/kernel/net/adapters");
|
||||
if (!file->open(Core::OpenMode::ReadOnly)) {
|
||||
dbgln("Failed to open /sys/kernel/net/adapters: {}", file->error_string());
|
||||
return {};
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include <LibCore/Command.h>
|
||||
#include <LibCore/ConfigFile.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <unistd.h>
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
#include <AK/String.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibCore/ConfigFile.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/Directory.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/SessionManagement.h>
|
||||
#include <LibCore/SocketAddress.h>
|
||||
#include <LibCore/System.h>
|
||||
|
@ -123,7 +123,7 @@ ErrorOr<void> Service::activate()
|
|||
|
||||
ErrorOr<void> Service::spawn(int socket_fd)
|
||||
{
|
||||
if (!Core::File::exists(m_executable_path)) {
|
||||
if (!Core::DeprecatedFile::exists(m_executable_path)) {
|
||||
dbgln("{}: binary \"{}\" does not exist, skipping service.", name(), m_executable_path);
|
||||
return Error::from_errno(ENOENT);
|
||||
}
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
#include <Kernel/API/DeviceEvent.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/ConfigFile.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/Event.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <errno.h>
|
||||
|
@ -72,7 +72,7 @@ static ErrorOr<void> determine_system_mode()
|
|||
g_system_mode = "text";
|
||||
});
|
||||
|
||||
auto f = Core::File::construct("/sys/kernel/system_mode");
|
||||
auto f = Core::DeprecatedFile::construct("/sys/kernel/system_mode");
|
||||
if (!f->open(Core::OpenMode::ReadOnly)) {
|
||||
dbgln("Failed to read system_mode: {}", f->error_string());
|
||||
// Continue and assume "text" mode.
|
||||
|
@ -188,7 +188,7 @@ static ErrorOr<void> populate_devtmpfs_char_devices_based_on_sysfs()
|
|||
|
||||
static ErrorOr<void> populate_devtmpfs_devices_based_on_devctl()
|
||||
{
|
||||
auto f = Core::File::construct("/dev/devctl");
|
||||
auto f = Core::DeprecatedFile::construct("/dev/devctl");
|
||||
if (!f->open(Core::OpenMode::ReadOnly)) {
|
||||
warnln("Failed to open /dev/devctl - {}", f->error_string());
|
||||
VERIFY_NOT_REACHED();
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
#include <AK/HashMap.h>
|
||||
#include <AK/Types.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/TCPServer.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <fcntl.h>
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*/
|
||||
|
||||
#include "ImageCodecPluginSerenity.h"
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/LocalServer.h>
|
||||
#include <LibCore/StandardPaths.h>
|
||||
#include <LibCore/Stream.h>
|
||||
|
@ -29,7 +29,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
|
||||
// This must be first; we can't check if /tmp/webdriver exists once we've unveiled other paths.
|
||||
auto webdriver_socket_path = DeprecatedString::formatted("{}/webdriver", TRY(Core::StandardPaths::runtime_directory()));
|
||||
if (Core::File::exists(webdriver_socket_path))
|
||||
if (Core::DeprecatedFile::exists(webdriver_socket_path))
|
||||
TRY(Core::System::unveil(webdriver_socket_path, "rw"sv));
|
||||
|
||||
TRY(Core::System::unveil("/res", "r"));
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
#include <AK/StringBuilder.h>
|
||||
#include <AK/URL.h>
|
||||
#include <LibCore/DateTime.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibCore/MimeData.h>
|
||||
#include <LibHTTP/HttpRequest.h>
|
||||
|
@ -132,7 +132,7 @@ ErrorOr<bool> Client::handle_request(ReadonlyBytes raw_request)
|
|||
path_builder.append(requested_path);
|
||||
auto real_path = TRY(path_builder.to_string());
|
||||
|
||||
if (Core::File::is_directory(real_path.bytes_as_string_view())) {
|
||||
if (Core::DeprecatedFile::is_directory(real_path.bytes_as_string_view())) {
|
||||
if (!resource_decoded.ends_with('/')) {
|
||||
StringBuilder red;
|
||||
|
||||
|
@ -147,14 +147,14 @@ ErrorOr<bool> Client::handle_request(ReadonlyBytes raw_request)
|
|||
index_html_path_builder.append(real_path);
|
||||
index_html_path_builder.append("/index.html"sv);
|
||||
auto index_html_path = TRY(index_html_path_builder.to_string());
|
||||
if (!Core::File::exists(index_html_path)) {
|
||||
if (!Core::DeprecatedFile::exists(index_html_path)) {
|
||||
TRY(handle_directory_listing(requested_path, real_path, request));
|
||||
return true;
|
||||
}
|
||||
real_path = index_html_path;
|
||||
}
|
||||
|
||||
auto file = Core::File::construct(real_path.bytes_as_string_view());
|
||||
auto file = Core::DeprecatedFile::construct(real_path.bytes_as_string_view());
|
||||
if (!file->open(Core::OpenMode::ReadOnly)) {
|
||||
TRY(send_error_response(404, request));
|
||||
return false;
|
||||
|
@ -169,7 +169,7 @@ ErrorOr<bool> Client::handle_request(ReadonlyBytes raw_request)
|
|||
|
||||
auto const info = ContentInfo {
|
||||
.type = TRY(String::from_deprecated_string(Core::guess_mime_type_based_on_filename(real_path.bytes_as_string_view()))),
|
||||
.length = TRY(Core::File::size(real_path.bytes_as_string_view()))
|
||||
.length = TRY(Core::DeprecatedFile::size(real_path.bytes_as_string_view()))
|
||||
};
|
||||
TRY(send_response(*stream, request, move(info)));
|
||||
return true;
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibCore/TCPServer.h>
|
||||
|
@ -56,8 +56,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return 1;
|
||||
}
|
||||
|
||||
auto real_document_root_path = Core::File::real_path_for(document_root_path);
|
||||
if (!Core::File::exists(real_document_root_path)) {
|
||||
auto real_document_root_path = Core::DeprecatedFile::real_path_for(document_root_path);
|
||||
if (!Core::DeprecatedFile::exists(real_document_root_path)) {
|
||||
warnln("Root path does not exist: '{}'", document_root_path);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <AK/JsonObject.h>
|
||||
#include <LibCore/ConfigFile.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/Process.h>
|
||||
#include <WindowServer/KeymapSwitcher.h>
|
||||
#include <spawn.h>
|
||||
|
@ -90,7 +90,7 @@ void KeymapSwitcher::next_keymap()
|
|||
|
||||
DeprecatedString KeymapSwitcher::get_current_keymap() const
|
||||
{
|
||||
auto proc_keymap = Core::File::construct("/sys/kernel/keymap");
|
||||
auto proc_keymap = Core::DeprecatedFile::construct("/sys/kernel/keymap");
|
||||
if (!proc_keymap->open(Core::OpenMode::ReadOnly))
|
||||
VERIFY_NOT_REACHED();
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
#include "WindowManager.h"
|
||||
#include <Kernel/API/Graphics.h>
|
||||
#include <LibCore/ConfigFile.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
#include <LibGfx/SystemTheme.h>
|
||||
|
@ -85,7 +85,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
if (!path.starts_with("connector"sv))
|
||||
continue;
|
||||
auto full_path = DeprecatedString::formatted("/dev/gpu/{}", path);
|
||||
if (!Core::File::is_device(full_path))
|
||||
if (!Core::DeprecatedFile::is_device(full_path))
|
||||
continue;
|
||||
auto display_connector_fd = TRY(Core::System::open(full_path, O_RDWR | O_CLOEXEC));
|
||||
if (int rc = graphics_connector_set_responsible(display_connector_fd); rc != 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue