mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 08:27:46 +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
|
@ -14,7 +14,6 @@
|
|||
#include <AK/Span.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <LibAudio/Loader.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/Stream.h>
|
||||
|
||||
namespace Audio {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <LibAudio/WavWriter.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
|
||||
namespace Audio {
|
||||
|
||||
|
@ -31,7 +32,7 @@ WavWriter::~WavWriter()
|
|||
|
||||
void WavWriter::set_file(StringView path)
|
||||
{
|
||||
m_file = Core::File::construct(path);
|
||||
m_file = Core::DeprecatedFile::construct(path);
|
||||
if (!m_file->open(Core::OpenMode::ReadWrite)) {
|
||||
m_error_string = DeprecatedString::formatted("Can't open file: {}", m_file->error_string());
|
||||
return;
|
||||
|
|
|
@ -6,10 +6,13 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Noncopyable.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <LibAudio/Sample.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/Forward.h>
|
||||
|
||||
namespace Audio {
|
||||
|
||||
|
@ -31,7 +34,7 @@ public:
|
|||
u32 sample_rate() const { return m_sample_rate; }
|
||||
u16 num_channels() const { return m_num_channels; }
|
||||
u16 bits_per_sample() const { return m_bits_per_sample; }
|
||||
RefPtr<Core::File> file() const { return m_file; }
|
||||
RefPtr<Core::DeprecatedFile> file() const { return m_file; }
|
||||
|
||||
void set_file(StringView path);
|
||||
void set_num_channels(int num_channels) { m_num_channels = num_channels; }
|
||||
|
@ -42,7 +45,7 @@ public:
|
|||
|
||||
private:
|
||||
void write_header();
|
||||
RefPtr<Core::File> m_file;
|
||||
RefPtr<Core::DeprecatedFile> m_file;
|
||||
DeprecatedString m_error_string;
|
||||
bool m_finalized { false };
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <AK/ScopedValueRollback.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <Kernel/API/Unveil.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <alloca.h>
|
||||
#include <assert.h>
|
||||
#include <bits/pthread_cancel.h>
|
||||
|
@ -188,7 +188,7 @@ int execvpe(char const* filename, char* const argv[], char* const envp[])
|
|||
|
||||
ScopedValueRollback errno_rollback(errno);
|
||||
|
||||
// TODO: Make this use the PATH search implementation from Core::File.
|
||||
// TODO: Make this use the PATH search implementation from Core::DeprecatedFile.
|
||||
DeprecatedString path = getenv("PATH");
|
||||
if (path.is_empty())
|
||||
path = DEFAULT_PATH;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <AK/Debug.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibCore/File.h>
|
||||
|
||||
namespace Chess::UCI {
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
#include <AK/HashTable.h>
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCpp/AST.h>
|
||||
#include <LibCpp/Lexer.h>
|
||||
#include <LibCpp/Parser.h>
|
||||
|
@ -736,7 +736,7 @@ Optional<Vector<CodeComprehension::AutocompleteResultEntry>> CppComprehensionEng
|
|||
if (!path.starts_with(partial_basename))
|
||||
continue;
|
||||
|
||||
if (Core::File::is_directory(LexicalPath::join(full_dir, path).string())) {
|
||||
if (Core::DeprecatedFile::is_directory(LexicalPath::join(full_dir, path).string())) {
|
||||
// FIXME: Don't dismiss the autocomplete when filling these suggestions.
|
||||
auto completion = DeprecatedString::formatted("{}{}{}/", prefix, include_dir, path);
|
||||
options.empend(completion, include_dir.length() + partial_basename.length() + 1, CodeComprehension::Language::Cpp, path, CodeComprehension::AutocompleteResultEntry::HideAutocompleteAfterApplying::No);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "../FileDB.h"
|
||||
#include "CppComprehensionEngine.h"
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
||||
static bool s_some_test_failed = false;
|
||||
|
@ -77,7 +77,7 @@ int run_tests()
|
|||
|
||||
static void add_file(FileDB& filedb, DeprecatedString const& name)
|
||||
{
|
||||
auto file = Core::File::open(LexicalPath::join(TESTS_ROOT_DIR, name).string(), Core::OpenMode::ReadOnly);
|
||||
auto file = Core::DeprecatedFile::open(LexicalPath::join(TESTS_ROOT_DIR, name).string(), Core::OpenMode::ReadOnly);
|
||||
VERIFY(!file.is_error());
|
||||
filedb.add(name, DeprecatedString::copy(file.value()->read_all()));
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
#include <ConfigServer/ConfigClientEndpoint.h>
|
||||
#include <ConfigServer/ConfigServerEndpoint.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/Promise.h>
|
||||
#include <LibCore/StandardPaths.h>
|
||||
#include <LibIPC/ConnectionToServer.h>
|
||||
|
|
|
@ -4,12 +4,12 @@ set(SOURCES
|
|||
Command.cpp
|
||||
ConfigFile.cpp
|
||||
DateTime.cpp
|
||||
DeprecatedFile.cpp
|
||||
Directory.cpp
|
||||
DirIterator.cpp
|
||||
ElapsedTimer.cpp
|
||||
Event.cpp
|
||||
EventLoop.cpp
|
||||
File.cpp
|
||||
IODevice.cpp
|
||||
LockFile.cpp
|
||||
MappedFile.cpp
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "Command.h"
|
||||
#include <AK/Format.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/wait.h>
|
||||
|
@ -73,8 +73,8 @@ ErrorOr<CommandResult> command(DeprecatedString const& program, Vector<Deprecate
|
|||
close(stderr_pipe[1]);
|
||||
|
||||
auto read_all_from_pipe = [](int pipe[2]) {
|
||||
auto result_file = Core::File::construct();
|
||||
if (!result_file->open(pipe[0], Core::OpenMode::ReadOnly, Core::File::ShouldCloseFileDescriptor::Yes)) {
|
||||
auto result_file = Core::DeprecatedFile::construct();
|
||||
if (!result_file->open(pipe[0], Core::OpenMode::ReadOnly, Core::DeprecatedFile::ShouldCloseFileDescriptor::Yes)) {
|
||||
perror("open");
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
#include <AK/LexicalPath.h>
|
||||
#include <AK/Platform.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -30,27 +30,27 @@
|
|||
|
||||
namespace Core {
|
||||
|
||||
ErrorOr<NonnullRefPtr<File>> File::open(DeprecatedString filename, OpenMode mode, mode_t permissions)
|
||||
ErrorOr<NonnullRefPtr<DeprecatedFile>> DeprecatedFile::open(DeprecatedString filename, OpenMode mode, mode_t permissions)
|
||||
{
|
||||
auto file = File::construct(move(filename));
|
||||
auto file = DeprecatedFile::construct(move(filename));
|
||||
if (!file->open_impl(mode, permissions))
|
||||
return Error::from_errno(file->error());
|
||||
return file;
|
||||
}
|
||||
|
||||
File::File(DeprecatedString filename, Object* parent)
|
||||
DeprecatedFile::DeprecatedFile(DeprecatedString filename, Object* parent)
|
||||
: IODevice(parent)
|
||||
, m_filename(move(filename))
|
||||
{
|
||||
}
|
||||
|
||||
File::~File()
|
||||
DeprecatedFile::~DeprecatedFile()
|
||||
{
|
||||
if (m_should_close_file_descriptor == ShouldCloseFileDescriptor::Yes && mode() != OpenMode::NotOpen)
|
||||
close();
|
||||
}
|
||||
|
||||
bool File::open(int fd, OpenMode mode, ShouldCloseFileDescriptor should_close)
|
||||
bool DeprecatedFile::open(int fd, OpenMode mode, ShouldCloseFileDescriptor should_close)
|
||||
{
|
||||
set_fd(fd);
|
||||
set_mode(mode);
|
||||
|
@ -58,12 +58,12 @@ bool File::open(int fd, OpenMode mode, ShouldCloseFileDescriptor should_close)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool File::open(OpenMode mode)
|
||||
bool DeprecatedFile::open(OpenMode mode)
|
||||
{
|
||||
return open_impl(mode, 0666);
|
||||
}
|
||||
|
||||
bool File::open_impl(OpenMode mode, mode_t permissions)
|
||||
bool DeprecatedFile::open_impl(OpenMode mode, mode_t permissions)
|
||||
{
|
||||
VERIFY(!m_filename.is_null());
|
||||
int flags = 0;
|
||||
|
@ -96,18 +96,18 @@ bool File::open_impl(OpenMode mode, mode_t permissions)
|
|||
return true;
|
||||
}
|
||||
|
||||
int File::leak_fd()
|
||||
int DeprecatedFile::leak_fd()
|
||||
{
|
||||
m_should_close_file_descriptor = ShouldCloseFileDescriptor::No;
|
||||
return fd();
|
||||
}
|
||||
|
||||
bool File::is_device() const
|
||||
bool DeprecatedFile::is_device() const
|
||||
{
|
||||
return is_device(fd());
|
||||
}
|
||||
|
||||
bool File::is_device(DeprecatedString const& filename)
|
||||
bool DeprecatedFile::is_device(DeprecatedString const& filename)
|
||||
{
|
||||
struct stat st;
|
||||
if (stat(filename.characters(), &st) < 0)
|
||||
|
@ -115,7 +115,7 @@ bool File::is_device(DeprecatedString const& filename)
|
|||
return S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode);
|
||||
}
|
||||
|
||||
bool File::is_device(int fd)
|
||||
bool DeprecatedFile::is_device(int fd)
|
||||
{
|
||||
struct stat st;
|
||||
if (fstat(fd, &st) < 0)
|
||||
|
@ -123,7 +123,7 @@ bool File::is_device(int fd)
|
|||
return S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode);
|
||||
}
|
||||
|
||||
bool File::is_block_device() const
|
||||
bool DeprecatedFile::is_block_device() const
|
||||
{
|
||||
struct stat stat;
|
||||
if (fstat(fd(), &stat) < 0)
|
||||
|
@ -131,7 +131,7 @@ bool File::is_block_device() const
|
|||
return S_ISBLK(stat.st_mode);
|
||||
}
|
||||
|
||||
bool File::is_block_device(DeprecatedString const& filename)
|
||||
bool DeprecatedFile::is_block_device(DeprecatedString const& filename)
|
||||
{
|
||||
struct stat st;
|
||||
if (stat(filename.characters(), &st) < 0)
|
||||
|
@ -139,7 +139,7 @@ bool File::is_block_device(DeprecatedString const& filename)
|
|||
return S_ISBLK(st.st_mode);
|
||||
}
|
||||
|
||||
bool File::is_char_device() const
|
||||
bool DeprecatedFile::is_char_device() const
|
||||
{
|
||||
struct stat stat;
|
||||
if (fstat(fd(), &stat) < 0)
|
||||
|
@ -147,7 +147,7 @@ bool File::is_char_device() const
|
|||
return S_ISCHR(stat.st_mode);
|
||||
}
|
||||
|
||||
bool File::is_char_device(DeprecatedString const& filename)
|
||||
bool DeprecatedFile::is_char_device(DeprecatedString const& filename)
|
||||
{
|
||||
struct stat st;
|
||||
if (stat(filename.characters(), &st) < 0)
|
||||
|
@ -155,12 +155,12 @@ bool File::is_char_device(DeprecatedString const& filename)
|
|||
return S_ISCHR(st.st_mode);
|
||||
}
|
||||
|
||||
bool File::is_directory() const
|
||||
bool DeprecatedFile::is_directory() const
|
||||
{
|
||||
return is_directory(fd());
|
||||
}
|
||||
|
||||
bool File::is_directory(DeprecatedString const& filename)
|
||||
bool DeprecatedFile::is_directory(DeprecatedString const& filename)
|
||||
{
|
||||
struct stat st;
|
||||
if (stat(filename.characters(), &st) < 0)
|
||||
|
@ -168,7 +168,7 @@ bool File::is_directory(DeprecatedString const& filename)
|
|||
return S_ISDIR(st.st_mode);
|
||||
}
|
||||
|
||||
bool File::is_directory(int fd)
|
||||
bool DeprecatedFile::is_directory(int fd)
|
||||
{
|
||||
struct stat st;
|
||||
if (fstat(fd, &st) < 0)
|
||||
|
@ -176,7 +176,7 @@ bool File::is_directory(int fd)
|
|||
return S_ISDIR(st.st_mode);
|
||||
}
|
||||
|
||||
bool File::is_link() const
|
||||
bool DeprecatedFile::is_link() const
|
||||
{
|
||||
struct stat stat;
|
||||
if (fstat(fd(), &stat) < 0)
|
||||
|
@ -184,7 +184,7 @@ bool File::is_link() const
|
|||
return S_ISLNK(stat.st_mode);
|
||||
}
|
||||
|
||||
bool File::is_link(DeprecatedString const& filename)
|
||||
bool DeprecatedFile::is_link(DeprecatedString const& filename)
|
||||
{
|
||||
struct stat st;
|
||||
if (lstat(filename.characters(), &st) < 0)
|
||||
|
@ -192,17 +192,17 @@ bool File::is_link(DeprecatedString const& filename)
|
|||
return S_ISLNK(st.st_mode);
|
||||
}
|
||||
|
||||
bool File::looks_like_shared_library() const
|
||||
bool DeprecatedFile::looks_like_shared_library() const
|
||||
{
|
||||
return File::looks_like_shared_library(m_filename);
|
||||
return DeprecatedFile::looks_like_shared_library(m_filename);
|
||||
}
|
||||
|
||||
bool File::looks_like_shared_library(DeprecatedString const& filename)
|
||||
bool DeprecatedFile::looks_like_shared_library(DeprecatedString const& filename)
|
||||
{
|
||||
return filename.ends_with(".so"sv) || filename.contains(".so."sv);
|
||||
}
|
||||
|
||||
bool File::can_delete_or_move(StringView path)
|
||||
bool DeprecatedFile::can_delete_or_move(StringView path)
|
||||
{
|
||||
VERIFY(!path.is_empty());
|
||||
auto directory = LexicalPath::dirname(path);
|
||||
|
@ -229,12 +229,12 @@ bool File::can_delete_or_move(StringView path)
|
|||
return user_id == 0 || directory_stat.st_uid == user_id || stat_or_empty(path).st_uid == user_id;
|
||||
}
|
||||
|
||||
bool File::exists(StringView filename)
|
||||
bool DeprecatedFile::exists(StringView filename)
|
||||
{
|
||||
return !Core::System::stat(filename).is_error();
|
||||
}
|
||||
|
||||
ErrorOr<size_t> File::size(DeprecatedString const& filename)
|
||||
ErrorOr<size_t> DeprecatedFile::size(DeprecatedString const& filename)
|
||||
{
|
||||
struct stat st;
|
||||
if (stat(filename.characters(), &st) < 0)
|
||||
|
@ -242,7 +242,7 @@ ErrorOr<size_t> File::size(DeprecatedString const& filename)
|
|||
return st.st_size;
|
||||
}
|
||||
|
||||
DeprecatedString File::real_path_for(DeprecatedString const& filename)
|
||||
DeprecatedString DeprecatedFile::real_path_for(DeprecatedString const& filename)
|
||||
{
|
||||
if (filename.is_null())
|
||||
return {};
|
||||
|
@ -252,7 +252,7 @@ DeprecatedString File::real_path_for(DeprecatedString const& filename)
|
|||
return real_path;
|
||||
}
|
||||
|
||||
DeprecatedString File::current_working_directory()
|
||||
DeprecatedString DeprecatedFile::current_working_directory()
|
||||
{
|
||||
char* cwd = getcwd(nullptr, 0);
|
||||
if (!cwd) {
|
||||
|
@ -266,15 +266,15 @@ DeprecatedString File::current_working_directory()
|
|||
return cwd_as_string;
|
||||
}
|
||||
|
||||
DeprecatedString File::absolute_path(DeprecatedString const& path)
|
||||
DeprecatedString DeprecatedFile::absolute_path(DeprecatedString const& path)
|
||||
{
|
||||
if (File::exists(path))
|
||||
return File::real_path_for(path);
|
||||
if (DeprecatedFile::exists(path))
|
||||
return DeprecatedFile::real_path_for(path);
|
||||
|
||||
if (path.starts_with("/"sv))
|
||||
return LexicalPath::canonicalized_path(path);
|
||||
|
||||
auto working_directory = File::current_working_directory();
|
||||
auto working_directory = DeprecatedFile::current_working_directory();
|
||||
auto full_path = LexicalPath::join(working_directory, path);
|
||||
|
||||
return LexicalPath::canonicalized_path(full_path.string());
|
||||
|
@ -282,7 +282,7 @@ DeprecatedString File::absolute_path(DeprecatedString const& path)
|
|||
|
||||
#ifdef AK_OS_SERENITY
|
||||
|
||||
ErrorOr<DeprecatedString> File::read_link(DeprecatedString const& link_path)
|
||||
ErrorOr<DeprecatedString> DeprecatedFile::read_link(DeprecatedString const& link_path)
|
||||
{
|
||||
// First, try using a 64-byte buffer, that ought to be enough for anybody.
|
||||
char small_buffer[64];
|
||||
|
@ -323,7 +323,7 @@ ErrorOr<DeprecatedString> File::read_link(DeprecatedString const& link_path)
|
|||
|
||||
// This is a sad version for other systems. It has to always make a copy of the
|
||||
// link path, and to always make two syscalls to get the right size first.
|
||||
ErrorOr<DeprecatedString> File::read_link(DeprecatedString const& link_path)
|
||||
ErrorOr<DeprecatedString> DeprecatedFile::read_link(DeprecatedString const& link_path)
|
||||
{
|
||||
struct stat statbuf = {};
|
||||
int rc = lstat(link_path.characters(), &statbuf);
|
||||
|
@ -341,32 +341,32 @@ ErrorOr<DeprecatedString> File::read_link(DeprecatedString const& link_path)
|
|||
|
||||
#endif
|
||||
|
||||
static RefPtr<File> stdin_file;
|
||||
static RefPtr<File> stdout_file;
|
||||
static RefPtr<File> stderr_file;
|
||||
static RefPtr<DeprecatedFile> stdin_file;
|
||||
static RefPtr<DeprecatedFile> stdout_file;
|
||||
static RefPtr<DeprecatedFile> stderr_file;
|
||||
|
||||
NonnullRefPtr<File> File::standard_input()
|
||||
NonnullRefPtr<DeprecatedFile> DeprecatedFile::standard_input()
|
||||
{
|
||||
if (!stdin_file) {
|
||||
stdin_file = File::construct();
|
||||
stdin_file = DeprecatedFile::construct();
|
||||
stdin_file->open(STDIN_FILENO, OpenMode::ReadOnly, ShouldCloseFileDescriptor::No);
|
||||
}
|
||||
return *stdin_file;
|
||||
}
|
||||
|
||||
NonnullRefPtr<File> File::standard_output()
|
||||
NonnullRefPtr<DeprecatedFile> DeprecatedFile::standard_output()
|
||||
{
|
||||
if (!stdout_file) {
|
||||
stdout_file = File::construct();
|
||||
stdout_file = DeprecatedFile::construct();
|
||||
stdout_file->open(STDOUT_FILENO, OpenMode::WriteOnly, ShouldCloseFileDescriptor::No);
|
||||
}
|
||||
return *stdout_file;
|
||||
}
|
||||
|
||||
NonnullRefPtr<File> File::standard_error()
|
||||
NonnullRefPtr<DeprecatedFile> DeprecatedFile::standard_error()
|
||||
{
|
||||
if (!stderr_file) {
|
||||
stderr_file = File::construct();
|
||||
stderr_file = DeprecatedFile::construct();
|
||||
stderr_file->open(STDERR_FILENO, OpenMode::WriteOnly, ShouldCloseFileDescriptor::No);
|
||||
}
|
||||
return *stderr_file;
|
||||
|
@ -397,7 +397,7 @@ static DeprecatedString get_duplicate_name(DeprecatedString const& path, int dup
|
|||
return duplicated_name.to_deprecated_string();
|
||||
}
|
||||
|
||||
ErrorOr<void, File::CopyError> File::copy_file_or_directory(DeprecatedString const& dst_path, DeprecatedString const& src_path, RecursionMode recursion_mode, LinkMode link_mode, AddDuplicateFileMarker add_duplicate_file_marker, PreserveMode preserve_mode)
|
||||
ErrorOr<void, DeprecatedFile::CopyError> DeprecatedFile::copy_file_or_directory(DeprecatedString const& dst_path, DeprecatedString const& src_path, RecursionMode recursion_mode, LinkMode link_mode, AddDuplicateFileMarker add_duplicate_file_marker, PreserveMode preserve_mode)
|
||||
{
|
||||
if (add_duplicate_file_marker == AddDuplicateFileMarker::Yes) {
|
||||
int duplicate_count = 0;
|
||||
|
@ -409,7 +409,7 @@ ErrorOr<void, File::CopyError> File::copy_file_or_directory(DeprecatedString con
|
|||
}
|
||||
}
|
||||
|
||||
auto source_or_error = File::open(src_path, OpenMode::ReadOnly);
|
||||
auto source_or_error = DeprecatedFile::open(src_path, OpenMode::ReadOnly);
|
||||
if (source_or_error.is_error())
|
||||
return CopyError { errno, false };
|
||||
|
||||
|
@ -435,7 +435,7 @@ ErrorOr<void, File::CopyError> File::copy_file_or_directory(DeprecatedString con
|
|||
return copy_file(dst_path, src_stat, source, preserve_mode);
|
||||
}
|
||||
|
||||
ErrorOr<void, File::CopyError> File::copy_file(DeprecatedString const& dst_path, struct stat const& src_stat, File& source, PreserveMode preserve_mode)
|
||||
ErrorOr<void, DeprecatedFile::CopyError> DeprecatedFile::copy_file(DeprecatedString const& dst_path, struct stat const& src_stat, DeprecatedFile& source, PreserveMode preserve_mode)
|
||||
{
|
||||
int dst_fd = creat(dst_path.characters(), 0666);
|
||||
if (dst_fd < 0) {
|
||||
|
@ -507,14 +507,14 @@ ErrorOr<void, File::CopyError> File::copy_file(DeprecatedString const& dst_path,
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void, File::CopyError> File::copy_directory(DeprecatedString const& dst_path, DeprecatedString const& src_path, struct stat const& src_stat, LinkMode link, PreserveMode preserve_mode)
|
||||
ErrorOr<void, DeprecatedFile::CopyError> DeprecatedFile::copy_directory(DeprecatedString const& dst_path, DeprecatedString const& src_path, struct stat const& src_stat, LinkMode link, PreserveMode preserve_mode)
|
||||
{
|
||||
if (mkdir(dst_path.characters(), 0755) < 0)
|
||||
return CopyError { errno, false };
|
||||
|
||||
DeprecatedString src_rp = File::real_path_for(src_path);
|
||||
DeprecatedString src_rp = DeprecatedFile::real_path_for(src_path);
|
||||
src_rp = DeprecatedString::formatted("{}/", src_rp);
|
||||
DeprecatedString dst_rp = File::real_path_for(dst_path);
|
||||
DeprecatedString dst_rp = DeprecatedFile::real_path_for(dst_path);
|
||||
dst_rp = DeprecatedString::formatted("{}/", dst_rp);
|
||||
|
||||
if (!dst_rp.is_empty() && dst_rp.starts_with(src_rp))
|
||||
|
@ -562,7 +562,7 @@ ErrorOr<void, File::CopyError> File::copy_directory(DeprecatedString const& dst_
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> File::link_file(DeprecatedString const& dst_path, DeprecatedString const& src_path)
|
||||
ErrorOr<void> DeprecatedFile::link_file(DeprecatedString const& dst_path, DeprecatedString const& src_path)
|
||||
{
|
||||
int duplicate_count = 0;
|
||||
while (access(get_duplicate_name(dst_path, duplicate_count).characters(), F_OK) == 0) {
|
||||
|
@ -576,7 +576,7 @@ ErrorOr<void> File::link_file(DeprecatedString const& dst_path, DeprecatedString
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> File::remove(StringView path, RecursionMode mode)
|
||||
ErrorOr<void> DeprecatedFile::remove(StringView path, RecursionMode mode)
|
||||
{
|
||||
auto path_stat = TRY(Core::System::lstat(path));
|
||||
|
||||
|
@ -597,7 +597,7 @@ ErrorOr<void> File::remove(StringView path, RecursionMode mode)
|
|||
return {};
|
||||
}
|
||||
|
||||
Optional<DeprecatedString> File::resolve_executable_from_environment(StringView filename)
|
||||
Optional<DeprecatedString> DeprecatedFile::resolve_executable_from_environment(StringView filename)
|
||||
{
|
||||
if (filename.is_empty())
|
||||
return {};
|
|
@ -21,12 +21,12 @@ namespace Core {
|
|||
/// Use of Core::File for reading/writing data is deprecated.
|
||||
/// Please use Core::Stream::File and Core::Stream::BufferedFile instead.
|
||||
///
|
||||
class File final : public IODevice {
|
||||
C_OBJECT(File)
|
||||
class DeprecatedFile final : public IODevice {
|
||||
C_OBJECT(DeprecatedFile)
|
||||
public:
|
||||
virtual ~File() override;
|
||||
virtual ~DeprecatedFile() override;
|
||||
|
||||
static ErrorOr<NonnullRefPtr<File>> open(DeprecatedString filename, OpenMode, mode_t = 0644);
|
||||
static ErrorOr<NonnullRefPtr<DeprecatedFile>> open(DeprecatedString filename, OpenMode, mode_t = 0644);
|
||||
|
||||
DeprecatedString filename() const { return m_filename; }
|
||||
void set_filename(const DeprecatedString filename) { m_filename = move(filename); }
|
||||
|
@ -86,7 +86,7 @@ public:
|
|||
bool tried_recursing;
|
||||
};
|
||||
|
||||
static ErrorOr<void, CopyError> copy_file(DeprecatedString const& dst_path, struct stat const& src_stat, File& source, PreserveMode = PreserveMode::Nothing);
|
||||
static ErrorOr<void, CopyError> copy_file(DeprecatedString const& dst_path, struct stat const& src_stat, DeprecatedFile& source, PreserveMode = PreserveMode::Nothing);
|
||||
static ErrorOr<void, CopyError> copy_directory(DeprecatedString const& dst_path, DeprecatedString const& src_path, struct stat const& src_stat, LinkMode = LinkMode::Disallowed, PreserveMode = PreserveMode::Nothing);
|
||||
static ErrorOr<void, CopyError> copy_file_or_directory(DeprecatedString const& dst_path, DeprecatedString const& src_path, RecursionMode = RecursionMode::Allowed, LinkMode = LinkMode::Disallowed, AddDuplicateFileMarker = AddDuplicateFileMarker::Yes, PreserveMode = PreserveMode::Nothing);
|
||||
|
||||
|
@ -105,18 +105,18 @@ public:
|
|||
bool open(int fd, OpenMode, ShouldCloseFileDescriptor);
|
||||
[[nodiscard]] int leak_fd();
|
||||
|
||||
static NonnullRefPtr<File> standard_input();
|
||||
static NonnullRefPtr<File> standard_output();
|
||||
static NonnullRefPtr<File> standard_error();
|
||||
static NonnullRefPtr<DeprecatedFile> standard_input();
|
||||
static NonnullRefPtr<DeprecatedFile> standard_output();
|
||||
static NonnullRefPtr<DeprecatedFile> standard_error();
|
||||
|
||||
static Optional<DeprecatedString> resolve_executable_from_environment(StringView filename);
|
||||
|
||||
private:
|
||||
File(Object* parent = nullptr)
|
||||
DeprecatedFile(Object* parent = nullptr)
|
||||
: IODevice(parent)
|
||||
{
|
||||
}
|
||||
explicit File(DeprecatedString filename, Object* parent = nullptr);
|
||||
explicit DeprecatedFile(DeprecatedString filename, Object* parent = nullptr);
|
||||
|
||||
bool open_impl(OpenMode, mode_t);
|
||||
|
||||
|
@ -124,6 +124,6 @@ private:
|
|||
ShouldCloseFileDescriptor m_should_close_file_descriptor { ShouldCloseFileDescriptor::Yes };
|
||||
};
|
||||
|
||||
AK_ENUM_BITWISE_OPERATORS(File::PreserveMode);
|
||||
AK_ENUM_BITWISE_OPERATORS(DeprecatedFile::PreserveMode);
|
||||
|
||||
}
|
|
@ -14,12 +14,12 @@ class ChildEvent;
|
|||
class ConfigFile;
|
||||
class CustomEvent;
|
||||
class DateTime;
|
||||
class DeprecatedFile;
|
||||
class DirIterator;
|
||||
class DeferredInvocationContext;
|
||||
class ElapsedTimer;
|
||||
class Event;
|
||||
class EventLoop;
|
||||
class File;
|
||||
class IODevice;
|
||||
class LocalServer;
|
||||
class MimeData;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include <AK/CharacterTypes.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/Group.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibCore/UmaskScope.h>
|
||||
|
|
|
@ -36,7 +36,7 @@ ErrorOr<NonnullOwnPtr<File>> File::adopt_fd(int fd, OpenMode mode, ShouldCloseFi
|
|||
}
|
||||
|
||||
if (!has_any_flag(mode, OpenMode::ReadWrite)) {
|
||||
dbgln("Core::File::adopt_fd: Attempting to adopt a file with neither Read nor Write specified in mode");
|
||||
dbgln("Core::DeprecatedFile::adopt_fd: Attempting to adopt a file with neither Read nor Write specified in mode");
|
||||
return Error::from_errno(EINVAL);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <AK/ScopedValueRollback.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/SessionManagement.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <limits.h>
|
||||
|
@ -1156,7 +1156,7 @@ ErrorOr<void> exec(StringView filename, ReadonlySpan<StringView> arguments, Sear
|
|||
DeprecatedString exec_filename;
|
||||
|
||||
if (search_in_path == SearchInPath::Yes) {
|
||||
auto maybe_executable = Core::File::resolve_executable_from_environment(filename);
|
||||
auto maybe_executable = Core::DeprecatedFile::resolve_executable_from_environment(filename);
|
||||
|
||||
if (!maybe_executable.has_value())
|
||||
return ENOENT;
|
||||
|
@ -1195,7 +1195,7 @@ ErrorOr<void> exec(StringView filename, ReadonlySpan<StringView> arguments, Sear
|
|||
// These BSDs don't support execvpe(), so we'll have to manually search the PATH.
|
||||
ScopedValueRollback errno_rollback(errno);
|
||||
|
||||
auto maybe_executable = Core::File::resolve_executable_from_environment(filename_string);
|
||||
auto maybe_executable = Core::DeprecatedFile::resolve_executable_from_environment(filename_string);
|
||||
|
||||
if (!maybe_executable.has_value()) {
|
||||
errno_rollback.set_override_rollback_value(ENOENT);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include "TempFile.h"
|
||||
#include <AK/Random.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
|
@ -45,11 +45,11 @@ TempFile::TempFile(Type type)
|
|||
|
||||
TempFile::~TempFile()
|
||||
{
|
||||
File::RecursionMode recursion_allowed { File::RecursionMode::Disallowed };
|
||||
DeprecatedFile::RecursionMode recursion_allowed { DeprecatedFile::RecursionMode::Disallowed };
|
||||
if (m_type == Type::Directory)
|
||||
recursion_allowed = File::RecursionMode::Allowed;
|
||||
recursion_allowed = DeprecatedFile::RecursionMode::Allowed;
|
||||
|
||||
auto rc = File::remove(m_path, recursion_allowed);
|
||||
auto rc = DeprecatedFile::remove(m_path, recursion_allowed);
|
||||
if (rc.is_error()) {
|
||||
warnln("File::remove failed: {}", rc.error().string_literal());
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <AK/Platform.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/Types.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibCoredump/Backtrace.h>
|
||||
#include <LibCoredump/Reader.h>
|
||||
|
@ -26,7 +26,7 @@ ELFObjectInfo const* Backtrace::object_info_for_region(Reader const& coredump, M
|
|||
if (maybe_ptr.has_value())
|
||||
return *maybe_ptr;
|
||||
|
||||
if (!Core::File::exists(path))
|
||||
if (!Core::DeprecatedFile::exists(path))
|
||||
return nullptr;
|
||||
|
||||
auto file_or_error = Core::MappedFile::map(path);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <AK/JsonValue.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <LibCompress/Gzip.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCoredump/Reader.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
|
@ -297,7 +297,7 @@ DeprecatedString Reader::resolve_object_path(StringView name) const
|
|||
// (e.g. UserspaceEmulator, LibSymbolication, Profiler, and DynamicLinker itself)
|
||||
// We should consider creating unified implementation in the future.
|
||||
|
||||
if (name.starts_with('/') || !Core::File::looks_like_shared_library(name)) {
|
||||
if (name.starts_with('/') || !Core::DeprecatedFile::looks_like_shared_library(name)) {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
|
|
@ -108,13 +108,13 @@ TranslationUnit[0:0->144:0]
|
|||
[const] char
|
||||
output_filename
|
||||
NullPointerLiteral[21:34->21:40]
|
||||
VariableDeclaration[22:4->22:50]
|
||||
VariableDeclaration[22:4->22:60]
|
||||
NamedType[22:4->22:7]
|
||||
auto
|
||||
trace_file
|
||||
FunctionCall[22:22->22:50]
|
||||
Name[22:22->22:47]
|
||||
Core::File::standard_error
|
||||
FunctionCall[22:22->22:60]
|
||||
Name[22:22->22:57]
|
||||
Core::DeprecatedFile::standard_error
|
||||
VariableDeclaration[24:4->24:27]
|
||||
NamedType[24:4->24:19]
|
||||
Core::ArgsParser
|
||||
|
@ -192,16 +192,16 @@ TranslationUnit[0:0->144:0]
|
|||
NullPointerLiteral[33:27->33:33]
|
||||
Then:
|
||||
BlockStatement[33:36->42:4]
|
||||
VariableDeclaration[34:8->34:87]
|
||||
VariableDeclaration[34:8->34:97]
|
||||
NamedType[34:8->34:11]
|
||||
auto
|
||||
open_result
|
||||
FunctionCall[34:27->34:87]
|
||||
Name[34:27->34:42]
|
||||
Core::File::open
|
||||
Name[34:44->34:58]
|
||||
FunctionCall[34:27->34:97]
|
||||
Name[34:27->34:52]
|
||||
Core::DeprecatedFile::open
|
||||
Name[34:54->34:68]
|
||||
output_filename
|
||||
Name[34:61->34:85]
|
||||
Name[34:71->34:95]
|
||||
Core::OpenMode::WriteOnly
|
||||
IfStatement[35:8->39:8]
|
||||
Predicate:
|
||||
|
|
|
@ -20,7 +20,7 @@ int main(int argc, char** argv)
|
|||
Vector<const char*> child_argv;
|
||||
|
||||
const char* output_filename = nullptr;
|
||||
auto trace_file = Core::File::standard_error();
|
||||
auto trace_file = Core::DeprecatedFile::standard_error();
|
||||
|
||||
Core::ArgsParser parser;
|
||||
parser.set_general_help(
|
||||
|
@ -32,7 +32,7 @@ int main(int argc, char** argv)
|
|||
parser.parse(argc, argv);
|
||||
|
||||
if (output_filename != nullptr) {
|
||||
auto open_result = Core::File::open(output_filename, Core::OpenMode::WriteOnly);
|
||||
auto open_result = Core::DeprecatedFile::open(output_filename, Core::OpenMode::WriteOnly);
|
||||
if (open_result.is_error()) {
|
||||
outln(stderr, "Failed to open output file: {}", open_result.error());
|
||||
return 1;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <AK/LexicalPath.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/Platform.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibRegex/Regex.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/mman.h>
|
||||
|
@ -444,7 +444,7 @@ Optional<DebugSession::InsertBreakpointAtSourcePositionResult> DebugSession::ins
|
|||
|
||||
void DebugSession::update_loaded_libs()
|
||||
{
|
||||
auto file = Core::File::construct(DeprecatedString::formatted("/proc/{}/vm", m_debuggee_pid));
|
||||
auto file = Core::DeprecatedFile::construct(DeprecatedString::formatted("/proc/{}/vm", m_debuggee_pid));
|
||||
bool rc = file->open(Core::OpenMode::ReadOnly);
|
||||
VERIFY(rc);
|
||||
|
||||
|
@ -476,7 +476,7 @@ void DebugSession::update_loaded_libs()
|
|||
return IterationDecision::Continue;
|
||||
|
||||
DeprecatedString lib_name = object_path.value();
|
||||
if (Core::File::looks_like_shared_library(lib_name))
|
||||
if (Core::DeprecatedFile::looks_like_shared_library(lib_name))
|
||||
lib_name = LexicalPath::basename(object_path.value());
|
||||
|
||||
FlatPtr base_address = entry.as_object().get_addr("address"sv).value_or(0);
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibFileSystemAccessClient/Client.h>
|
||||
#include <LibGUI/ConnectionToWindowServer.h>
|
||||
#include <LibGUI/MessageBox.h>
|
||||
|
@ -41,7 +40,7 @@ DeprecatedResult Client::try_request_file_read_only_approved_deprecated(GUI::Win
|
|||
if (path.starts_with('/')) {
|
||||
async_request_file_read_only_approved(id, parent_window_server_client_id, parent_window_id, path);
|
||||
} else {
|
||||
auto full_path = LexicalPath::join(Core::File::current_working_directory(), path).string();
|
||||
auto full_path = LexicalPath::join(Core::DeprecatedFile::current_working_directory(), path).string();
|
||||
async_request_file_read_only_approved(id, parent_window_server_client_id, parent_window_id, full_path);
|
||||
}
|
||||
|
||||
|
@ -66,7 +65,7 @@ Result Client::request_file_read_only_approved(GUI::Window* parent_window, Depre
|
|||
if (path.starts_with('/')) {
|
||||
async_request_file_read_only_approved(id, parent_window_server_client_id, parent_window_id, path);
|
||||
} else {
|
||||
auto full_path = LexicalPath::join(Core::File::current_working_directory(), path).string();
|
||||
auto full_path = LexicalPath::join(Core::DeprecatedFile::current_working_directory(), path).string();
|
||||
async_request_file_read_only_approved(id, parent_window_server_client_id, parent_window_id, full_path);
|
||||
}
|
||||
|
||||
|
@ -114,7 +113,7 @@ DeprecatedResult Client::try_request_file_deprecated(GUI::Window* parent_window,
|
|||
if (path.starts_with('/')) {
|
||||
async_request_file(id, parent_window_server_client_id, parent_window_id, path, mode);
|
||||
} else {
|
||||
auto full_path = LexicalPath::join(Core::File::current_working_directory(), path).string();
|
||||
auto full_path = LexicalPath::join(Core::DeprecatedFile::current_working_directory(), path).string();
|
||||
async_request_file(id, parent_window_server_client_id, parent_window_id, full_path, mode);
|
||||
}
|
||||
|
||||
|
@ -139,7 +138,7 @@ Result Client::request_file(GUI::Window* parent_window, DeprecatedString const&
|
|||
if (path.starts_with('/')) {
|
||||
async_request_file(id, parent_window_server_client_id, parent_window_id, path, mode);
|
||||
} else {
|
||||
auto full_path = LexicalPath::join(Core::File::current_working_directory(), path).string();
|
||||
auto full_path = LexicalPath::join(Core::DeprecatedFile::current_working_directory(), path).string();
|
||||
async_request_file(id, parent_window_server_client_id, parent_window_id, full_path, mode);
|
||||
}
|
||||
|
||||
|
@ -253,22 +252,22 @@ void Client::handle_prompt_end(i32 request_id, i32 error, Optional<IPC::File> co
|
|||
return;
|
||||
}
|
||||
|
||||
if (Core::File::is_device(ipc_file->fd())) {
|
||||
if (Core::DeprecatedFile::is_device(ipc_file->fd())) {
|
||||
GUI::MessageBox::show_error(request_data.parent_window, DeprecatedString::formatted("Opening \"{}\" failed: Cannot open device files", *chosen_file));
|
||||
resolve_any_promise(Error::from_string_literal("Cannot open device files"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (Core::File::is_directory(ipc_file->fd())) {
|
||||
if (Core::DeprecatedFile::is_directory(ipc_file->fd())) {
|
||||
GUI::MessageBox::show_error(request_data.parent_window, DeprecatedString::formatted("Opening \"{}\" failed: Cannot open directory", *chosen_file));
|
||||
resolve_any_promise(Error::from_errno(EISDIR));
|
||||
return;
|
||||
}
|
||||
|
||||
if (request_data.promise.has<PromiseType<DeprecatedResult>>()) {
|
||||
auto file = Core::File::construct();
|
||||
auto file = Core::DeprecatedFile::construct();
|
||||
auto fd = ipc_file->take_fd();
|
||||
file->open(fd, Core::OpenMode::ReadWrite, Core::File::ShouldCloseFileDescriptor::Yes);
|
||||
file->open(fd, Core::OpenMode::ReadWrite, Core::DeprecatedFile::ShouldCloseFileDescriptor::Yes);
|
||||
file->set_filename(*chosen_file);
|
||||
|
||||
request_data.promise.get<PromiseType<DeprecatedResult>>()->resolve(file);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <AK/String.h>
|
||||
#include <FileSystemAccessServer/FileSystemAccessClientEndpoint.h>
|
||||
#include <FileSystemAccessServer/FileSystemAccessServerEndpoint.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/Promise.h>
|
||||
#include <LibCore/StandardPaths.h>
|
||||
#include <LibGUI/Window.h>
|
||||
|
@ -37,7 +37,7 @@ private:
|
|||
String m_filename;
|
||||
};
|
||||
|
||||
using DeprecatedResult = ErrorOr<NonnullRefPtr<Core::File>>;
|
||||
using DeprecatedResult = ErrorOr<NonnullRefPtr<Core::DeprecatedFile>>;
|
||||
using Result = ErrorOr<File>;
|
||||
|
||||
class Client final
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include <AK/LexicalPath.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <LibCore/ConfigFile.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibGUI/AbstractThemePreview.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <AK/JsonArray.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/StandardPaths.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibGUI/CommonLocationsProvider.h>
|
||||
|
@ -25,7 +25,7 @@ static void initialize_if_needed()
|
|||
return;
|
||||
|
||||
auto user_config = DeprecatedString::formatted("{}/CommonLocations.json", Core::StandardPaths::config_directory());
|
||||
if (Core::File::exists(user_config)) {
|
||||
if (Core::DeprecatedFile::exists(user_config)) {
|
||||
auto maybe_error = CommonLocationsProvider::load_from_json(user_config);
|
||||
if (!maybe_error.is_error())
|
||||
return;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <LibCore/ConfigFile.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibCore/StandardPaths.h>
|
||||
#include <LibELF/Image.h>
|
||||
|
@ -255,7 +255,7 @@ Icon FileIconProvider::icon_for_path(DeprecatedString const& path, mode_t mode)
|
|||
return s_directory_icon;
|
||||
}
|
||||
if (S_ISLNK(mode)) {
|
||||
auto raw_symlink_target_or_error = Core::File::read_link(path);
|
||||
auto raw_symlink_target_or_error = Core::DeprecatedFile::read_link(path);
|
||||
if (raw_symlink_target_or_error.is_error())
|
||||
return s_symlink_icon;
|
||||
|
||||
|
@ -267,7 +267,7 @@ Icon FileIconProvider::icon_for_path(DeprecatedString const& path, mode_t mode)
|
|||
if (raw_symlink_target.starts_with('/')) {
|
||||
target_path = raw_symlink_target;
|
||||
} else {
|
||||
target_path = Core::File::real_path_for(DeprecatedString::formatted("{}/{}", LexicalPath::dirname(path), raw_symlink_target));
|
||||
target_path = Core::DeprecatedFile::real_path_for(DeprecatedString::formatted("{}/{}", LexicalPath::dirname(path), raw_symlink_target));
|
||||
}
|
||||
auto target_icon = icon_for_path(target_path);
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <AK/Function.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/StandardPaths.h>
|
||||
#include <LibGUI/Action.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
|
@ -310,7 +310,7 @@ void FilePicker::on_file_return()
|
|||
path = LexicalPath::join(m_model->root_path(), path).string();
|
||||
}
|
||||
|
||||
bool file_exists = Core::File::exists(path);
|
||||
bool file_exists = Core::DeprecatedFile::exists(path);
|
||||
|
||||
if (!file_exists && (m_mode == Mode::Open || m_mode == Mode::OpenFolder)) {
|
||||
MessageBox::show(this, DeprecatedString::formatted("No such file or directory: {}", m_filename_textbox->text()), "File not found"sv, MessageBox::Type::Error, MessageBox::InputType::OK);
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
#include <AK/NumberFormat.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/StandardPaths.h>
|
||||
#include <LibGUI/AbstractView.h>
|
||||
#include <LibGUI/FileIconProvider.h>
|
||||
|
@ -61,7 +61,7 @@ bool FileSystemModel::Node::fetch_data(DeprecatedString const& full_path, bool i
|
|||
mtime = st.st_mtime;
|
||||
|
||||
if (S_ISLNK(mode)) {
|
||||
auto sym_link_target_or_error = Core::File::read_link(full_path);
|
||||
auto sym_link_target_or_error = Core::DeprecatedFile::read_link(full_path);
|
||||
if (sym_link_target_or_error.is_error())
|
||||
perror("readlink");
|
||||
else {
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
*/
|
||||
|
||||
#include <AK/JsonObject.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibGUI/JsonArrayModel.h>
|
||||
|
||||
namespace GUI {
|
||||
|
||||
void JsonArrayModel::invalidate()
|
||||
{
|
||||
auto file = Core::File::construct(m_json_path);
|
||||
auto file = Core::DeprecatedFile::construct(m_json_path);
|
||||
if (!file->open(Core::OpenMode::ReadOnly)) {
|
||||
dbgln("Unable to open {}", file->filename());
|
||||
m_array.clear();
|
||||
|
@ -30,7 +30,7 @@ void JsonArrayModel::invalidate()
|
|||
|
||||
void JsonArrayModel::update()
|
||||
{
|
||||
auto file = Core::File::construct(m_json_path);
|
||||
auto file = Core::DeprecatedFile::construct(m_json_path);
|
||||
if (!file->open(Core::OpenMode::ReadOnly)) {
|
||||
dbgln("Unable to open {}", file->filename());
|
||||
m_array.clear();
|
||||
|
@ -48,7 +48,7 @@ void JsonArrayModel::update()
|
|||
|
||||
bool JsonArrayModel::store()
|
||||
{
|
||||
auto file = Core::File::construct(m_json_path);
|
||||
auto file = Core::DeprecatedFile::construct(m_json_path);
|
||||
if (!file->open(Core::OpenMode::WriteOnly)) {
|
||||
dbgln("Unable to open {}", file->filename());
|
||||
return false;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <AK/ScopeGuard.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/TemporaryChange.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/Timer.h>
|
||||
#include <LibGUI/Action.h>
|
||||
#include <LibGUI/AutocompleteProvider.h>
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
#include <AK/NonnullRefPtrVector.h>
|
||||
#include <AK/Queue.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibGfx/Font/Font.h>
|
||||
#include <LibGfx/Font/FontDatabase.h>
|
||||
#include <LibGfx/Font/OpenType/Font.h>
|
||||
|
@ -136,7 +136,7 @@ void FontDatabase::load_all_fonts_from_path(DeprecatedString const& root)
|
|||
while (dir_iterator.has_next()) {
|
||||
auto path = dir_iterator.next_full_path();
|
||||
|
||||
if (Core::File::is_directory(path)) {
|
||||
if (Core::DeprecatedFile::is_directory(path)) {
|
||||
path_queue.enqueue(path);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <AK/Assertions.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/Stream.h>
|
||||
|
||||
[[noreturn]] static void report_parsing_error(StringView message, StringView filename, StringView input, size_t offset)
|
||||
|
@ -138,10 +138,10 @@ static HashTable<DeprecatedString> import_stack;
|
|||
Optional<Interface&> Parser::resolve_import(auto path)
|
||||
{
|
||||
auto include_path = LexicalPath::join(import_base_path, path).string();
|
||||
if (!Core::File::exists(include_path))
|
||||
if (!Core::DeprecatedFile::exists(include_path))
|
||||
report_parsing_error(DeprecatedString::formatted("{}: No such file or directory", include_path), filename, input, lexer.tell());
|
||||
|
||||
auto real_path = Core::File::real_path_for(include_path);
|
||||
auto real_path = Core::DeprecatedFile::real_path_for(include_path);
|
||||
if (top_level_resolved_imports().contains(real_path))
|
||||
return *top_level_resolved_imports().find(real_path)->value;
|
||||
|
||||
|
@ -884,7 +884,7 @@ void resolve_function_typedefs(Interface& interface, FunctionType& function)
|
|||
|
||||
Interface& Parser::parse()
|
||||
{
|
||||
auto this_module = Core::File::real_path_for(filename);
|
||||
auto this_module = Core::DeprecatedFile::real_path_for(filename);
|
||||
|
||||
auto interface_ptr = make<Interface>();
|
||||
auto& interface = *interface_ptr;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <AK/ScopeGuard.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibJS/AST.h>
|
||||
#include <LibJS/Interpreter.h>
|
||||
#include <LibJS/Runtime/AbstractOperations.h>
|
||||
|
@ -833,18 +833,18 @@ static DeprecatedString resolve_module_filename(StringView filename, StringView
|
|||
auto extensions = Vector<StringView, 2> { "js"sv, "mjs"sv };
|
||||
if (module_type == "json"sv)
|
||||
extensions = { "json"sv };
|
||||
if (!Core::File::exists(filename)) {
|
||||
if (!Core::DeprecatedFile::exists(filename)) {
|
||||
for (auto extension : extensions) {
|
||||
// import "./foo" -> import "./foo.ext"
|
||||
auto resolved_filepath = DeprecatedString::formatted("{}.{}", filename, extension);
|
||||
if (Core::File::exists(resolved_filepath))
|
||||
if (Core::DeprecatedFile::exists(resolved_filepath))
|
||||
return resolved_filepath;
|
||||
}
|
||||
} else if (Core::File::is_directory(filename)) {
|
||||
} else if (Core::DeprecatedFile::is_directory(filename)) {
|
||||
for (auto extension : extensions) {
|
||||
// import "./foo" -> import "./foo/index.ext"
|
||||
auto resolved_filepath = LexicalPath::join(filename, DeprecatedString::formatted("index.{}", extension)).string();
|
||||
if (Core::File::exists(resolved_filepath))
|
||||
if (Core::DeprecatedFile::exists(resolved_filepath))
|
||||
return resolved_filepath;
|
||||
}
|
||||
}
|
||||
|
@ -916,7 +916,7 @@ ThrowCompletionOr<NonnullGCPtr<Module>> VM::resolve_imported_module(ScriptOrModu
|
|||
|
||||
dbgln_if(JS_MODULE_DEBUG, "[JS MODULE] reading and parsing module {}", filename);
|
||||
|
||||
auto file_or_error = Core::File::open(filename, Core::OpenMode::ReadOnly);
|
||||
auto file_or_error = Core::DeprecatedFile::open(filename, Core::OpenMode::ReadOnly);
|
||||
|
||||
if (file_or_error.is_error()) {
|
||||
return throw_completion<SyntaxError>(ErrorType::ModuleNotFound, module_request.module_specifier);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "CharacterMapFile.h"
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/Utf8View.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
|
||||
namespace Keyboard {
|
||||
|
||||
|
@ -22,7 +22,7 @@ ErrorOr<CharacterMapData> CharacterMapFile::load_from_file(DeprecatedString cons
|
|||
path = full_path.to_deprecated_string();
|
||||
}
|
||||
|
||||
auto file = TRY(Core::File::open(path, Core::OpenMode::ReadOnly));
|
||||
auto file = TRY(Core::DeprecatedFile::open(path, Core::OpenMode::ReadOnly));
|
||||
auto file_contents = file->read_all();
|
||||
auto json_result = TRY(JsonValue::from_string(file_contents));
|
||||
auto const& json = json_result.as_object();
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
#include <AK/Utf32View.h>
|
||||
#include <AK/Utf8View.h>
|
||||
#include <LibCore/ConfigFile.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/Event.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/Notifier.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -251,7 +251,7 @@ void Editor::add_to_history(DeprecatedString const& line)
|
|||
|
||||
bool Editor::load_history(DeprecatedString const& path)
|
||||
{
|
||||
auto history_file = Core::File::construct(path);
|
||||
auto history_file = Core::DeprecatedFile::construct(path);
|
||||
if (!history_file->open(Core::OpenMode::ReadOnly))
|
||||
return false;
|
||||
auto data = history_file->read_all();
|
||||
|
@ -311,7 +311,7 @@ bool Editor::save_history(DeprecatedString const& path)
|
|||
{
|
||||
Vector<HistoryEntry> final_history { { "", 0 } };
|
||||
{
|
||||
auto file_or_error = Core::File::open(path, Core::OpenMode::ReadWrite, 0600);
|
||||
auto file_or_error = Core::DeprecatedFile::open(path, Core::OpenMode::ReadWrite, 0600);
|
||||
if (file_or_error.is_error())
|
||||
return false;
|
||||
auto file = file_or_error.release_value();
|
||||
|
@ -326,7 +326,7 @@ bool Editor::save_history(DeprecatedString const& path)
|
|||
[](HistoryEntry const& left, HistoryEntry const& right) { return left.timestamp < right.timestamp; });
|
||||
}
|
||||
|
||||
auto file_or_error = Core::File::open(path, Core::OpenMode::WriteOnly, 0600);
|
||||
auto file_or_error = Core::DeprecatedFile::open(path, Core::OpenMode::WriteOnly, 0600);
|
||||
if (file_or_error.is_error())
|
||||
return false;
|
||||
auto file = file_or_error.release_value();
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <AK/Optional.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <AK/URL.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibManual/Path.h>
|
||||
|
||||
|
@ -49,7 +49,7 @@ ErrorOr<NonnullRefPtr<PageNode>> Node::try_create_from_query(Vector<StringView,
|
|||
Optional<NonnullRefPtr<PageNode>> maybe_page;
|
||||
for (auto const& section : sections) {
|
||||
auto const page = TRY(try_make_ref_counted<PageNode>(section, TRY(String::from_utf8(first_query_parameter))));
|
||||
if (Core::File::exists(TRY(page->path()))) {
|
||||
if (Core::DeprecatedFile::exists(TRY(page->path()))) {
|
||||
maybe_page = page;
|
||||
break;
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ ErrorOr<NonnullRefPtr<PageNode>> Node::try_create_from_query(Vector<StringView,
|
|||
auto second_query_parameter = *query_parameter_iterator;
|
||||
auto section = TRY(SectionNode::try_create_from_number(first_query_parameter));
|
||||
auto const page = TRY(try_make_ref_counted<PageNode>(section, TRY(String::from_utf8(second_query_parameter))));
|
||||
if (Core::File::exists(TRY(page->path())))
|
||||
if (Core::DeprecatedFile::exists(TRY(page->path())))
|
||||
return page;
|
||||
return Error::from_string_literal("Page doesn't exist in section");
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
#include "SubsectionNode.h"
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/File.h>
|
||||
|
||||
namespace Manual {
|
||||
|
||||
|
@ -54,7 +54,7 @@ ErrorOr<void> SectionNode::reify_if_needed() const
|
|||
while (dir_iter.has_next()) {
|
||||
LexicalPath lexical_path(dir_iter.next_path());
|
||||
if (lexical_path.extension() != "md") {
|
||||
if (Core::File::is_directory(LexicalPath::absolute_path(own_path.to_deprecated_string(), lexical_path.string()))) {
|
||||
if (Core::DeprecatedFile::is_directory(LexicalPath::absolute_path(own_path.to_deprecated_string(), lexical_path.string()))) {
|
||||
dbgln("Found subsection {}", lexical_path);
|
||||
children.append({ .node = TRY(try_make_ref_counted<SubsectionNode>(*this, lexical_path.title())),
|
||||
.name_for_sorting = TRY(String::from_utf8(lexical_path.title())) });
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
|
||||
#include <LibPartition/EBRPartitionTable.h>
|
||||
|
||||
#ifndef KERNEL
|
||||
# include <LibCore/DeprecatedFile.h>
|
||||
#endif
|
||||
|
||||
namespace Partition {
|
||||
|
||||
#ifdef KERNEL
|
||||
|
@ -13,7 +17,7 @@ ErrorOr<NonnullOwnPtr<EBRPartitionTable>> EBRPartitionTable::try_to_initialize(K
|
|||
{
|
||||
auto table = TRY(adopt_nonnull_own_or_enomem(new (nothrow) EBRPartitionTable(device)));
|
||||
#else
|
||||
ErrorOr<NonnullOwnPtr<EBRPartitionTable>> EBRPartitionTable::try_to_initialize(NonnullRefPtr<Core::File> device_file)
|
||||
ErrorOr<NonnullOwnPtr<EBRPartitionTable>> EBRPartitionTable::try_to_initialize(NonnullRefPtr<Core::DeprecatedFile> device_file)
|
||||
{
|
||||
auto table = TRY(adopt_nonnull_own_or_enomem(new (nothrow) EBRPartitionTable(move(device_file))));
|
||||
#endif
|
||||
|
@ -27,7 +31,7 @@ ErrorOr<NonnullOwnPtr<EBRPartitionTable>> EBRPartitionTable::try_to_initialize(N
|
|||
#ifdef KERNEL
|
||||
void EBRPartitionTable::search_extended_partition(Kernel::StorageDevice const& device, MBRPartitionTable& checked_ebr, u64 current_block_offset, size_t limit)
|
||||
#else
|
||||
void EBRPartitionTable::search_extended_partition(NonnullRefPtr<Core::File> device, MBRPartitionTable& checked_ebr, u64 current_block_offset, size_t limit)
|
||||
void EBRPartitionTable::search_extended_partition(NonnullRefPtr<Core::DeprecatedFile> device, MBRPartitionTable& checked_ebr, u64 current_block_offset, size_t limit)
|
||||
#endif
|
||||
{
|
||||
if (limit == 0)
|
||||
|
@ -51,7 +55,7 @@ void EBRPartitionTable::search_extended_partition(NonnullRefPtr<Core::File> devi
|
|||
#ifdef KERNEL
|
||||
EBRPartitionTable::EBRPartitionTable(Kernel::StorageDevice const& device)
|
||||
#else
|
||||
EBRPartitionTable::EBRPartitionTable(NonnullRefPtr<Core::File> device)
|
||||
EBRPartitionTable::EBRPartitionTable(NonnullRefPtr<Core::DeprecatedFile> device)
|
||||
#endif
|
||||
: MBRPartitionTable(device)
|
||||
{
|
||||
|
|
|
@ -19,8 +19,8 @@ public:
|
|||
static ErrorOr<NonnullOwnPtr<EBRPartitionTable>> try_to_initialize(Kernel::StorageDevice const&);
|
||||
explicit EBRPartitionTable(Kernel::StorageDevice const&);
|
||||
#else
|
||||
static ErrorOr<NonnullOwnPtr<EBRPartitionTable>> try_to_initialize(NonnullRefPtr<Core::File>);
|
||||
explicit EBRPartitionTable(NonnullRefPtr<Core::File>);
|
||||
static ErrorOr<NonnullOwnPtr<EBRPartitionTable>> try_to_initialize(NonnullRefPtr<Core::DeprecatedFile>);
|
||||
explicit EBRPartitionTable(NonnullRefPtr<Core::DeprecatedFile>);
|
||||
#endif
|
||||
|
||||
virtual bool is_valid() const override
|
||||
|
@ -32,7 +32,7 @@ private:
|
|||
#ifdef KERNEL
|
||||
void search_extended_partition(Kernel::StorageDevice const&, MBRPartitionTable&, u64, size_t limit);
|
||||
#else
|
||||
void search_extended_partition(NonnullRefPtr<Core::File>, MBRPartitionTable&, u64, size_t limit);
|
||||
void search_extended_partition(NonnullRefPtr<Core::DeprecatedFile>, MBRPartitionTable&, u64, size_t limit);
|
||||
#endif
|
||||
|
||||
bool m_valid { false };
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
#include <AK/Debug.h>
|
||||
#include <LibPartition/GUIDPartitionTable.h>
|
||||
|
||||
#ifndef KERNEL
|
||||
# include <LibCore/DeprecatedFile.h>
|
||||
#endif
|
||||
|
||||
namespace Partition {
|
||||
|
||||
#define GPT_SIGNATURE2 0x54524150
|
||||
|
@ -49,7 +53,7 @@ ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> GUIDPartitionTable::try_to_initialize
|
|||
{
|
||||
auto table = TRY(adopt_nonnull_own_or_enomem(new (nothrow) GUIDPartitionTable(device)));
|
||||
#else
|
||||
ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> GUIDPartitionTable::try_to_initialize(NonnullRefPtr<Core::File> device_file)
|
||||
ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> GUIDPartitionTable::try_to_initialize(NonnullRefPtr<Core::DeprecatedFile> device_file)
|
||||
{
|
||||
auto table = TRY(adopt_nonnull_own_or_enomem(new (nothrow) GUIDPartitionTable(move(device_file))));
|
||||
#endif
|
||||
|
@ -62,7 +66,7 @@ ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> GUIDPartitionTable::try_to_initialize
|
|||
GUIDPartitionTable::GUIDPartitionTable(Kernel::StorageDevice const& device)
|
||||
: MBRPartitionTable(device)
|
||||
#else
|
||||
GUIDPartitionTable::GUIDPartitionTable(NonnullRefPtr<Core::File> device_file)
|
||||
GUIDPartitionTable::GUIDPartitionTable(NonnullRefPtr<Core::DeprecatedFile> device_file)
|
||||
: MBRPartitionTable(move(device_file))
|
||||
#endif
|
||||
{
|
||||
|
|
|
@ -19,8 +19,8 @@ public:
|
|||
static ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> try_to_initialize(Kernel::StorageDevice const&);
|
||||
explicit GUIDPartitionTable(Kernel::StorageDevice const&);
|
||||
#else
|
||||
static ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> try_to_initialize(NonnullRefPtr<Core::File>);
|
||||
explicit GUIDPartitionTable(NonnullRefPtr<Core::File>);
|
||||
static ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> try_to_initialize(NonnullRefPtr<Core::DeprecatedFile>);
|
||||
explicit GUIDPartitionTable(NonnullRefPtr<Core::DeprecatedFile>);
|
||||
#endif
|
||||
|
||||
virtual bool is_valid() const override
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
#include <AK/Debug.h>
|
||||
#include <LibPartition/MBRPartitionTable.h>
|
||||
|
||||
#ifndef KERNEL
|
||||
# include <LibCore/DeprecatedFile.h>
|
||||
#endif
|
||||
|
||||
namespace Partition {
|
||||
|
||||
#define MBR_SIGNATURE 0xaa55
|
||||
|
@ -19,7 +23,7 @@ ErrorOr<NonnullOwnPtr<MBRPartitionTable>> MBRPartitionTable::try_to_initialize(K
|
|||
{
|
||||
auto table = TRY(adopt_nonnull_own_or_enomem(new (nothrow) MBRPartitionTable(device)));
|
||||
#else
|
||||
ErrorOr<NonnullOwnPtr<MBRPartitionTable>> MBRPartitionTable::try_to_initialize(NonnullRefPtr<Core::File> device_file)
|
||||
ErrorOr<NonnullOwnPtr<MBRPartitionTable>> MBRPartitionTable::try_to_initialize(NonnullRefPtr<Core::DeprecatedFile> device_file)
|
||||
{
|
||||
auto table = TRY(adopt_nonnull_own_or_enomem(new (nothrow) MBRPartitionTable(move(device_file))));
|
||||
#endif
|
||||
|
@ -37,7 +41,7 @@ OwnPtr<MBRPartitionTable> MBRPartitionTable::try_to_initialize(Kernel::StorageDe
|
|||
{
|
||||
auto table = adopt_nonnull_own_or_enomem(new (nothrow) MBRPartitionTable(device, start_lba)).release_value_but_fixme_should_propagate_errors();
|
||||
#else
|
||||
OwnPtr<MBRPartitionTable> MBRPartitionTable::try_to_initialize(NonnullRefPtr<Core::File> device_file, u32 start_lba)
|
||||
OwnPtr<MBRPartitionTable> MBRPartitionTable::try_to_initialize(NonnullRefPtr<Core::DeprecatedFile> device_file, u32 start_lba)
|
||||
{
|
||||
auto table = adopt_nonnull_own_or_enomem(new (nothrow) MBRPartitionTable(move(device_file), start_lba)).release_value_but_fixme_should_propagate_errors();
|
||||
#endif
|
||||
|
@ -65,7 +69,7 @@ bool MBRPartitionTable::read_boot_record()
|
|||
MBRPartitionTable::MBRPartitionTable(Kernel::StorageDevice const& device, u32 start_lba)
|
||||
: PartitionTable(device)
|
||||
#else
|
||||
MBRPartitionTable::MBRPartitionTable(NonnullRefPtr<Core::File> device_file, u32 start_lba)
|
||||
MBRPartitionTable::MBRPartitionTable(NonnullRefPtr<Core::DeprecatedFile> device_file, u32 start_lba)
|
||||
: PartitionTable(move(device_file))
|
||||
#endif
|
||||
, m_start_lba(start_lba)
|
||||
|
@ -91,7 +95,7 @@ MBRPartitionTable::MBRPartitionTable(NonnullRefPtr<Core::File> device_file, u32
|
|||
MBRPartitionTable::MBRPartitionTable(Kernel::StorageDevice const& device)
|
||||
: PartitionTable(device)
|
||||
#else
|
||||
MBRPartitionTable::MBRPartitionTable(NonnullRefPtr<Core::File> device_file)
|
||||
MBRPartitionTable::MBRPartitionTable(NonnullRefPtr<Core::DeprecatedFile> device_file)
|
||||
: PartitionTable(move(device_file))
|
||||
#endif
|
||||
, m_start_lba(0)
|
||||
|
|
|
@ -44,10 +44,10 @@ public:
|
|||
explicit MBRPartitionTable(Kernel::StorageDevice const&);
|
||||
MBRPartitionTable(Kernel::StorageDevice const&, u32 start_lba);
|
||||
#else
|
||||
static ErrorOr<NonnullOwnPtr<MBRPartitionTable>> try_to_initialize(NonnullRefPtr<Core::File>);
|
||||
static OwnPtr<MBRPartitionTable> try_to_initialize(NonnullRefPtr<Core::File>, u32 start_lba);
|
||||
explicit MBRPartitionTable(NonnullRefPtr<Core::File>);
|
||||
MBRPartitionTable(NonnullRefPtr<Core::File>, u32 start_lba);
|
||||
static ErrorOr<NonnullOwnPtr<MBRPartitionTable>> try_to_initialize(NonnullRefPtr<Core::DeprecatedFile>);
|
||||
static OwnPtr<MBRPartitionTable> try_to_initialize(NonnullRefPtr<Core::DeprecatedFile>, u32 start_lba);
|
||||
explicit MBRPartitionTable(NonnullRefPtr<Core::DeprecatedFile>);
|
||||
MBRPartitionTable(NonnullRefPtr<Core::DeprecatedFile>, u32 start_lba);
|
||||
#endif
|
||||
|
||||
bool is_protective_mbr() const;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <LibPartition/PartitionTable.h>
|
||||
|
||||
#ifndef KERNEL
|
||||
# include <LibCore/DeprecatedFile.h>
|
||||
# include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
|
@ -19,7 +20,7 @@ PartitionTable::PartitionTable(Kernel::StorageDevice const& device)
|
|||
{
|
||||
}
|
||||
#else
|
||||
PartitionTable::PartitionTable(NonnullRefPtr<Core::File> device_file)
|
||||
PartitionTable::PartitionTable(NonnullRefPtr<Core::DeprecatedFile> device_file)
|
||||
: m_device_file(device_file)
|
||||
{
|
||||
VERIFY(ioctl(m_device_file->leak_fd(), STORAGE_DEVICE_GET_BLOCK_SIZE, &m_block_size) >= 0);
|
||||
|
|
|
@ -6,12 +6,13 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/NonnullRefPtr.h>
|
||||
#include <LibPartition/DiskPartitionMetadata.h>
|
||||
|
||||
#ifdef KERNEL
|
||||
# include <Kernel/Storage/StorageDevice.h>
|
||||
#else
|
||||
# include <LibCore/File.h>
|
||||
# include <LibCore/Forward.h>
|
||||
#endif
|
||||
|
||||
namespace Partition {
|
||||
|
@ -31,8 +32,8 @@ protected:
|
|||
explicit PartitionTable(Kernel::StorageDevice const&);
|
||||
NonnullRefPtr<Kernel::StorageDevice> m_device;
|
||||
#else
|
||||
explicit PartitionTable(NonnullRefPtr<Core::File>);
|
||||
NonnullRefPtr<Core::File> m_device_file;
|
||||
explicit PartitionTable(NonnullRefPtr<Core::DeprecatedFile>);
|
||||
NonnullRefPtr<Core::DeprecatedFile> m_device_file;
|
||||
#endif
|
||||
|
||||
Vector<DiskPartitionMetadata> m_partitions;
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include <AK/Optional.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/Object.h>
|
||||
#include <LibSQL/Forward.h>
|
||||
#include <LibSQL/Heap.h>
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
#include <LibSQL/SQLClient.h>
|
||||
|
||||
#if !defined(AK_OS_SERENITY)
|
||||
# include <LibCore/DeprecatedFile.h>
|
||||
# include <LibCore/Directory.h>
|
||||
# include <LibCore/File.h>
|
||||
# include <LibCore/SocketAddress.h>
|
||||
# include <LibCore/StandardPaths.h>
|
||||
# include <LibCore/Stream.h>
|
||||
|
@ -25,7 +25,7 @@ namespace SQL {
|
|||
// This is heavily based on how SystemServer's Service creates its socket.
|
||||
static ErrorOr<int> create_database_socket(DeprecatedString const& socket_path)
|
||||
{
|
||||
if (Core::File::exists(socket_path))
|
||||
if (Core::DeprecatedFile::exists(socket_path))
|
||||
TRY(Core::System::unlink(socket_path));
|
||||
|
||||
# ifdef SOCK_NONBLOCK
|
||||
|
@ -103,7 +103,7 @@ static ErrorOr<void> launch_server(DeprecatedString const& socket_path, Deprecat
|
|||
|
||||
static ErrorOr<bool> should_launch_server(DeprecatedString const& pid_path)
|
||||
{
|
||||
if (!Core::File::exists(pid_path))
|
||||
if (!Core::DeprecatedFile::exists(pid_path))
|
||||
return true;
|
||||
|
||||
Optional<pid_t> pid;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <AK/JsonObject.h>
|
||||
#include <AK/JsonValue.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibDebug/DebugInfo.h>
|
||||
#include <LibSymbolication/Symbolication.h>
|
||||
|
@ -37,7 +37,7 @@ static KernelBaseState s_kernel_base_state = KernelBaseState::Uninitialized;
|
|||
Optional<FlatPtr> kernel_base()
|
||||
{
|
||||
if (s_kernel_base_state == KernelBaseState::Uninitialized) {
|
||||
auto file = Core::File::open("/sys/kernel/load_base", Core::OpenMode::ReadOnly);
|
||||
auto file = Core::DeprecatedFile::open("/sys/kernel/load_base", Core::OpenMode::ReadOnly);
|
||||
if (file.is_error()) {
|
||||
s_kernel_base_state = KernelBaseState::Invalid;
|
||||
return {};
|
||||
|
@ -65,7 +65,7 @@ Optional<Symbol> symbolicate(DeprecatedString const& path, FlatPtr address, Incl
|
|||
bool found = false;
|
||||
for (auto& search_path : search_paths) {
|
||||
full_path = LexicalPath::join(search_path, path).string();
|
||||
if (Core::File::exists(full_path)) {
|
||||
if (Core::DeprecatedFile::exists(full_path)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ Vector<Symbol> symbolicate_thread(pid_t pid, pid_t tid, IncludeSourcePosition in
|
|||
|
||||
{
|
||||
auto stack_path = DeprecatedString::formatted("/proc/{}/stacks/{}", pid, tid);
|
||||
auto file_or_error = Core::File::open(stack_path, Core::OpenMode::ReadOnly);
|
||||
auto file_or_error = Core::DeprecatedFile::open(stack_path, Core::OpenMode::ReadOnly);
|
||||
if (file_or_error.is_error()) {
|
||||
warnln("Could not open {}: {}", stack_path, file_or_error.error());
|
||||
return {};
|
||||
|
@ -167,7 +167,7 @@ Vector<Symbol> symbolicate_thread(pid_t pid, pid_t tid, IncludeSourcePosition in
|
|||
|
||||
{
|
||||
auto vm_path = DeprecatedString::formatted("/proc/{}/vm", pid);
|
||||
auto file_or_error = Core::File::open(vm_path, Core::OpenMode::ReadOnly);
|
||||
auto file_or_error = Core::DeprecatedFile::open(vm_path, Core::OpenMode::ReadOnly);
|
||||
if (file_or_error.is_error()) {
|
||||
warnln("Could not open {}: {}", vm_path, file_or_error.error());
|
||||
return {};
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <AK/Endian.h>
|
||||
#include <LibCore/ConfigFile.h>
|
||||
#include <LibCore/DateTime.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/Timer.h>
|
||||
#include <LibCrypto/ASN1/ASN1.h>
|
||||
#include <LibCrypto/ASN1/PEM.h>
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include <AK/Result.h>
|
||||
#include <AK/Tuple.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibJS/Bytecode/Interpreter.h>
|
||||
#include <LibJS/Interpreter.h>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibTest/JavaScriptTestRunner.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
|
@ -152,7 +153,7 @@ int main(int argc, char** argv)
|
|||
common_path = DeprecatedString::formatted("{}/Userland/Libraries/LibJS/Tests/test-common.js", serenity_source_dir);
|
||||
#endif
|
||||
}
|
||||
if (!Core::File::is_directory(test_root)) {
|
||||
if (!Core::DeprecatedFile::is_directory(test_root)) {
|
||||
warnln("Test root is not a directory: {}", test_root);
|
||||
return 1;
|
||||
}
|
||||
|
@ -170,8 +171,8 @@ int main(int argc, char** argv)
|
|||
#endif
|
||||
}
|
||||
|
||||
test_root = Core::File::real_path_for(test_root);
|
||||
common_path = Core::File::real_path_for(common_path);
|
||||
test_root = Core::DeprecatedFile::real_path_for(test_root);
|
||||
common_path = Core::DeprecatedFile::real_path_for(common_path);
|
||||
|
||||
if (chdir(test_root.characters()) < 0) {
|
||||
auto saved_errno = errno;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <AK/Debug.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <LibCore/ElapsedTimer.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibWeb/Cookie/Cookie.h>
|
||||
#include <LibWeb/Cookie/ParsedCookie.h>
|
||||
#include <LibWeb/Loader/ContentFilter.h>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibCore/File.h>
|
||||
#include <LibProtocol/Request.h>
|
||||
#include <LibProtocol/RequestClient.h>
|
||||
#include <LibWebView/RequestServerAdapter.h>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue