mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 09:27:45 +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
|
@ -8,8 +8,8 @@
|
|||
#include <AK/Types.h>
|
||||
#include <LibAudio/Loader.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/ElapsedTimer.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <stdio.h>
|
||||
|
@ -28,7 +28,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
args_parser.add_option(sample_count, "How many samples to load at maximum", "sample-count", 's', "samples");
|
||||
args_parser.parse(args);
|
||||
|
||||
TRY(Core::System::unveil(Core::File::absolute_path(path), "r"sv));
|
||||
TRY(Core::System::unveil(Core::DeprecatedFile::absolute_path(path), "r"sv));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
TRY(Core::System::pledge("stdio recvfd rpath"));
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
#include <LibAudio/Loader.h>
|
||||
#include <LibAudio/Resampler.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <math.h>
|
||||
|
@ -36,7 +36,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.parse(arguments);
|
||||
|
||||
TRY(Core::System::unveil("/tmp/session/%sid/portal/audio", "rw"));
|
||||
TRY(Core::System::unveil(Core::File::absolute_path(path), "r"sv));
|
||||
TRY(Core::System::unveil(Core::DeprecatedFile::absolute_path(path), "r"sv));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
Core::EventLoop loop;
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include <LibAudio/ConnectionToServer.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <math.h>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
@ -68,7 +68,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (path != "-" && Core::File::is_directory(path)) {
|
||||
if (path != "-" && Core::DeprecatedFile::is_directory(path)) {
|
||||
warnln("Failed to open file{} '{}': is a directory", file_number, path);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <stdio.h>
|
||||
|
@ -17,7 +17,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::pledge("stdio rpath wpath cpath fattr chown"));
|
||||
|
||||
bool link = false;
|
||||
auto preserve = Core::File::PreserveMode::Nothing;
|
||||
auto preserve = Core::DeprecatedFile::PreserveMode::Nothing;
|
||||
bool recursion_allowed = false;
|
||||
bool verbose = false;
|
||||
Vector<StringView> sources;
|
||||
|
@ -33,7 +33,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
"attributes",
|
||||
[&preserve](char const* s) {
|
||||
if (!s) {
|
||||
preserve = Core::File::PreserveMode::Permissions | Core::File::PreserveMode::Ownership | Core::File::PreserveMode::Timestamps;
|
||||
preserve = Core::DeprecatedFile::PreserveMode::Permissions | Core::DeprecatedFile::PreserveMode::Ownership | Core::DeprecatedFile::PreserveMode::Timestamps;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -41,11 +41,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
StringView { s, strlen(s) }.for_each_split_view(',', SplitBehavior::Nothing, [&](StringView value) {
|
||||
if (value == "mode"sv) {
|
||||
preserve |= Core::File::PreserveMode::Permissions;
|
||||
preserve |= Core::DeprecatedFile::PreserveMode::Permissions;
|
||||
} else if (value == "ownership"sv) {
|
||||
preserve |= Core::File::PreserveMode::Ownership;
|
||||
preserve |= Core::DeprecatedFile::PreserveMode::Ownership;
|
||||
} else if (value == "timestamps"sv) {
|
||||
preserve |= Core::File::PreserveMode::Timestamps;
|
||||
preserve |= Core::DeprecatedFile::PreserveMode::Timestamps;
|
||||
} else {
|
||||
warnln("cp: Unknown or unimplemented --preserve attribute: '{}'", value);
|
||||
values_ok = false;
|
||||
|
@ -63,24 +63,24 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_positional_argument(destination, "Destination file path", "destination");
|
||||
args_parser.parse(arguments);
|
||||
|
||||
if (has_flag(preserve, Core::File::PreserveMode::Permissions)) {
|
||||
if (has_flag(preserve, Core::DeprecatedFile::PreserveMode::Permissions)) {
|
||||
umask(0);
|
||||
} else {
|
||||
TRY(Core::System::pledge("stdio rpath wpath cpath fattr"));
|
||||
}
|
||||
|
||||
bool destination_is_existing_dir = Core::File::is_directory(destination);
|
||||
bool destination_is_existing_dir = Core::DeprecatedFile::is_directory(destination);
|
||||
|
||||
for (auto& source : sources) {
|
||||
auto destination_path = destination_is_existing_dir
|
||||
? DeprecatedString::formatted("{}/{}", destination, LexicalPath::basename(source))
|
||||
: destination;
|
||||
|
||||
auto result = Core::File::copy_file_or_directory(
|
||||
auto result = Core::DeprecatedFile::copy_file_or_directory(
|
||||
destination_path, source,
|
||||
recursion_allowed ? Core::File::RecursionMode::Allowed : Core::File::RecursionMode::Disallowed,
|
||||
link ? Core::File::LinkMode::Allowed : Core::File::LinkMode::Disallowed,
|
||||
Core::File::AddDuplicateFileMarker::No,
|
||||
recursion_allowed ? Core::DeprecatedFile::RecursionMode::Allowed : Core::DeprecatedFile::RecursionMode::Disallowed,
|
||||
link ? Core::DeprecatedFile::LinkMode::Allowed : Core::DeprecatedFile::LinkMode::Disallowed,
|
||||
Core::DeprecatedFile::AddDuplicateFileMarker::No,
|
||||
preserve);
|
||||
|
||||
if (result.is_error()) {
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include <AK/StringBuilder.h>
|
||||
#include <Kernel/API/SyscallString.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibDebug/DebugSession.h>
|
||||
#include <LibELF/Image.h>
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
#include <AK/StringBuilder.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
@ -245,7 +245,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
Core::DirIterator it(recursive.value_or(base), Core::DirIterator::Flags::SkipDots);
|
||||
while (it.has_next()) {
|
||||
auto path = it.next_full_path();
|
||||
if (!Core::File::is_directory(path)) {
|
||||
if (!Core::DeprecatedFile::is_directory(path)) {
|
||||
auto key = user_has_specified_files ? path.view() : path.substring_view(base.length() + 1, path.length() - base.length() - 1);
|
||||
if (auto result = handle_file(key, true); result.is_error() && !suppress_errors)
|
||||
warnln("Failed with file {}: {}", key, result.release_error());
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
*/
|
||||
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <grp.h>
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
#include <AK/Types.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/ConfigFile.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibCore/SystemServerTakeover.h>
|
||||
|
@ -691,8 +691,8 @@ static void load_page_for_screenshot_and_exit(HeadlessBrowserPageClient& page_cl
|
|||
DeprecatedString output_file_path = "output.png";
|
||||
dbgln("Saving to {}", output_file_path);
|
||||
|
||||
if (Core::File::exists(output_file_path))
|
||||
MUST(Core::File::remove(output_file_path, Core::File::RecursionMode::Disallowed));
|
||||
if (Core::DeprecatedFile::exists(output_file_path))
|
||||
MUST(Core::DeprecatedFile::remove(output_file_path, Core::DeprecatedFile::RecursionMode::Disallowed));
|
||||
|
||||
auto output_file = MUST(Core::Stream::File::open(output_file_path, Core::Stream::OpenMode::Write));
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/ConfigFile.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
||||
|
@ -26,7 +26,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_positional_argument(value_to_write, "Value to write", "value", Core::ArgsParser::Required::No);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
if (!Core::File::exists(path)) {
|
||||
if (!Core::DeprecatedFile::exists(path)) {
|
||||
warnln("File does not exist: '{}'", path);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
#include <AK/LexicalPath.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/Directory.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/FilePermissionsMask.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
@ -35,7 +35,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
DeprecatedString destination_dir = (sources.size() > 1 ? DeprecatedString { destination } : LexicalPath::dirname(destination));
|
||||
|
||||
if (create_leading_dest_components) {
|
||||
DeprecatedString destination_dir_absolute = Core::File::absolute_path(destination_dir);
|
||||
DeprecatedString destination_dir_absolute = Core::DeprecatedFile::absolute_path(destination_dir);
|
||||
MUST(Core::Directory::create(destination_dir_absolute, Core::Directory::CreateDirectories::Yes));
|
||||
}
|
||||
|
||||
|
@ -47,9 +47,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
final_destination = destination;
|
||||
}
|
||||
|
||||
TRY(Core::File::copy_file_or_directory(final_destination, source, Core::File::RecursionMode::Allowed,
|
||||
Core::File::LinkMode::Disallowed, Core::File::AddDuplicateFileMarker::No,
|
||||
Core::File::PreserveMode::Nothing));
|
||||
TRY(Core::DeprecatedFile::copy_file_or_directory(final_destination, source, Core::DeprecatedFile::RecursionMode::Allowed,
|
||||
Core::DeprecatedFile::LinkMode::Disallowed, Core::DeprecatedFile::AddDuplicateFileMarker::No,
|
||||
Core::DeprecatedFile::PreserveMode::Nothing));
|
||||
|
||||
auto current_access = TRY(Core::System::stat(final_destination));
|
||||
TRY(Core::System::chmod(final_destination, permission_mask.apply(current_access.st_mode)));
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <AK/StringBuilder.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibELF/DynamicLinker.h>
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
#include <AK/Vector.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DateTime.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <ctype.h>
|
||||
|
@ -164,7 +164,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
for (size_t i = 0; i < files.size(); i++) {
|
||||
auto path = files[i].name;
|
||||
|
||||
if (flag_recursive && Core::File::is_directory(path)) {
|
||||
if (flag_recursive && Core::DeprecatedFile::is_directory(path)) {
|
||||
size_t subdirs = 0;
|
||||
Core::DirIterator di(path, Core::DirIterator::SkipParentAndBaseDir);
|
||||
|
||||
|
@ -175,7 +175,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
while (di.has_next()) {
|
||||
DeprecatedString directory = di.next_full_path();
|
||||
if (Core::File::is_directory(directory) && !Core::File::is_link(directory)) {
|
||||
if (Core::DeprecatedFile::is_directory(directory) && !Core::DeprecatedFile::is_link(directory)) {
|
||||
++subdirs;
|
||||
FileMetadata new_file;
|
||||
new_file.name = move(directory);
|
||||
|
@ -184,7 +184,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
}
|
||||
|
||||
bool show_dir_separator = files.size() > 1 && Core::File::is_directory(path) && !flag_list_directories_only;
|
||||
bool show_dir_separator = files.size() > 1 && Core::DeprecatedFile::is_directory(path) && !flag_list_directories_only;
|
||||
if (show_dir_separator) {
|
||||
printf("%s:\n", path.characters());
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ static DeprecatedString& hostname()
|
|||
static size_t print_name(const struct stat& st, DeprecatedString const& name, char const* path_for_link_resolution, char const* path_for_hyperlink)
|
||||
{
|
||||
if (!flag_disable_hyperlinks) {
|
||||
auto full_path = Core::File::real_path_for(path_for_hyperlink);
|
||||
auto full_path = Core::DeprecatedFile::real_path_for(path_for_hyperlink);
|
||||
if (!full_path.is_null()) {
|
||||
auto url = URL::create_with_file_scheme(full_path, {}, hostname());
|
||||
out("\033]8;;{}\033\\", url.serialize());
|
||||
|
@ -274,7 +274,7 @@ static size_t print_name(const struct stat& st, DeprecatedString const& name, ch
|
|||
}
|
||||
if (S_ISLNK(st.st_mode)) {
|
||||
if (path_for_link_resolution) {
|
||||
auto link_destination_or_error = Core::File::read_link(path_for_link_resolution);
|
||||
auto link_destination_or_error = Core::DeprecatedFile::read_link(path_for_link_resolution);
|
||||
if (link_destination_or_error.is_error()) {
|
||||
perror("readlink");
|
||||
} else {
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Utf8View.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <AK/URL.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <LibMarkdown/Document.h>
|
||||
|
@ -272,7 +272,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
// Since this should never happen anyway, fail early.
|
||||
return 1;
|
||||
}
|
||||
files.set(Core::File::real_path_for(path), MarkdownLinkage::analyze(*document));
|
||||
files.set(Core::DeprecatedFile::real_path_for(path), MarkdownLinkage::analyze(*document));
|
||||
}
|
||||
|
||||
outln("Checking links ...");
|
||||
|
@ -293,7 +293,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
} else {
|
||||
pointee_file = LexicalPath::absolute_path(file_dir, file_link.file_path);
|
||||
}
|
||||
if (!Core::File::exists(pointee_file) && !is_missing_file_acceptable(pointee_file)) {
|
||||
if (!Core::DeprecatedFile::exists(pointee_file) && !is_missing_file_acceptable(pointee_file)) {
|
||||
outln("File '{}' points to '{}' (label '{}'), but '{}' does not exist!",
|
||||
file_item.key, file_link.file_path, file_link.label, pointee_file);
|
||||
any_problems = true;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <stdio.h>
|
||||
|
@ -69,17 +69,17 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
new_path = combined_new_path.characters();
|
||||
}
|
||||
|
||||
if (no_clobber && Core::File::exists(new_path))
|
||||
if (no_clobber && Core::DeprecatedFile::exists(new_path))
|
||||
continue;
|
||||
|
||||
rc = rename(old_path.characters(), new_path.characters());
|
||||
if (rc < 0) {
|
||||
if (errno == EXDEV) {
|
||||
auto result = Core::File::copy_file_or_directory(
|
||||
auto result = Core::DeprecatedFile::copy_file_or_directory(
|
||||
new_path, old_path,
|
||||
Core::File::RecursionMode::Allowed,
|
||||
Core::File::LinkMode::Disallowed,
|
||||
Core::File::AddDuplicateFileMarker::No);
|
||||
Core::DeprecatedFile::RecursionMode::Allowed,
|
||||
Core::DeprecatedFile::LinkMode::Disallowed,
|
||||
Core::DeprecatedFile::AddDuplicateFileMarker::No);
|
||||
|
||||
if (result.is_error()) {
|
||||
warnln("mv: could not move '{}': {}", old_path, static_cast<Error const&>(result.error()));
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
#include <AK/URL.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibDesktop/Launcher.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
||||
|
@ -25,7 +25,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
bool all_ok = true;
|
||||
|
||||
for (auto& url_or_path : urls_or_paths) {
|
||||
auto path = Core::File::real_path_for(url_or_path);
|
||||
auto path = Core::DeprecatedFile::real_path_for(url_or_path);
|
||||
auto url = URL::create_with_url_or_path(path.is_null() ? url_or_path : path.view());
|
||||
|
||||
if (!Desktop::Launcher::open(url)) {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibELF/Image.h>
|
||||
|
@ -13,7 +13,7 @@
|
|||
|
||||
static ErrorOr<bool> is_dynamically_linked_executable(StringView filename)
|
||||
{
|
||||
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;
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
#include <AK/String.h>
|
||||
#include <AK/URL.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibHTTP/HttpResponse.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
@ -339,7 +339,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (i > -1)
|
||||
output_name = DeprecatedString::formatted("{}.{}", output_name, i);
|
||||
++i;
|
||||
} while (Core::File::exists(output_name));
|
||||
} while (Core::DeprecatedFile::exists(output_name));
|
||||
}
|
||||
|
||||
int target_file_fd = open(output_name.characters(), O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <AK/StringBuilder.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibELF/DynamicLoader.h>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
||||
|
@ -22,7 +22,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.parse(arguments);
|
||||
|
||||
for (auto path : paths) {
|
||||
auto destination = TRY(Core::File::read_link(path));
|
||||
auto destination = TRY(Core::DeprecatedFile::read_link(path));
|
||||
out("{}", destination);
|
||||
if (!no_newline)
|
||||
outln();
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include <AK/StringBuilder.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <stdio.h>
|
||||
|
@ -43,7 +43,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
continue;
|
||||
}
|
||||
|
||||
auto result = Core::File::remove(path, recursive ? Core::File::RecursionMode::Allowed : Core::File::RecursionMode::Disallowed);
|
||||
auto result = Core::DeprecatedFile::remove(path, recursive ? Core::DeprecatedFile::RecursionMode::Allowed : Core::DeprecatedFile::RecursionMode::Disallowed);
|
||||
|
||||
if (result.is_error()) {
|
||||
auto error = result.release_error();
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include <AK/LexicalPath.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/ConfigFile.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibCoredump/Backtrace.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
@ -365,12 +365,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
} else {
|
||||
test_root = "/usr/Tests";
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
test_root = Core::File::real_path_for(test_root);
|
||||
test_root = Core::DeprecatedFile::real_path_for(test_root);
|
||||
|
||||
auto void_or_error = Core::System::chdir(test_root);
|
||||
if (void_or_error.is_error()) {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <AK/URL.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DateTime.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/Process.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibGUI/Application.h>
|
||||
|
@ -175,7 +175,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
bool printed_hyperlink = false;
|
||||
if (isatty(STDOUT_FILENO)) {
|
||||
auto full_path = Core::File::real_path_for(output_path);
|
||||
auto full_path = Core::DeprecatedFile::real_path_for(output_path);
|
||||
if (!full_path.is_null()) {
|
||||
char hostname[HOST_NAME_MAX];
|
||||
VERIFY(gethostname(hostname, sizeof(hostname)) == 0);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <AK/String.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/StandardPaths.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibLine/Editor.h>
|
||||
|
@ -366,7 +366,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
SQLRepl repl(loop, database_name, move(sql_client));
|
||||
|
||||
if (!suppress_sqlrc && Core::File::exists(sqlrc_path))
|
||||
if (!suppress_sqlrc && Core::DeprecatedFile::exists(sqlrc_path))
|
||||
repl.source_file(sqlrc_path);
|
||||
if (!file_to_source.is_empty())
|
||||
repl.source_file(file_to_source);
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
#include <LibArchive/TarStream.h>
|
||||
#include <LibCompress/Gzip.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/Directory.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
@ -150,7 +150,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
outln("{}", filename);
|
||||
|
||||
if (extract) {
|
||||
DeprecatedString absolute_path = Core::File::absolute_path(filename);
|
||||
DeprecatedString absolute_path = Core::DeprecatedFile::absolute_path(filename);
|
||||
auto parent_path = LexicalPath(absolute_path).parent();
|
||||
auto header_mode = TRY(header.mode());
|
||||
|
||||
|
@ -220,7 +220,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
Archive::TarOutputStream tar_stream(move(output_stream));
|
||||
|
||||
auto add_file = [&](DeprecatedString path) -> ErrorOr<void> {
|
||||
auto file = Core::File::construct(path);
|
||||
auto file = Core::DeprecatedFile::construct(path);
|
||||
if (!file->open(Core::OpenMode::ReadOnly)) {
|
||||
warnln("Failed to open {}: {}", path, file->error_string());
|
||||
return {};
|
||||
|
@ -257,9 +257,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
Core::DirIterator it(path, Core::DirIterator::Flags::SkipParentAndBaseDir);
|
||||
while (it.has_next()) {
|
||||
auto child_path = it.next_full_path();
|
||||
if (!dereference && Core::File::is_link(child_path)) {
|
||||
if (!dereference && Core::DeprecatedFile::is_link(child_path)) {
|
||||
TRY(add_link(child_path));
|
||||
} else if (!Core::File::is_directory(child_path)) {
|
||||
} else if (!Core::DeprecatedFile::is_directory(child_path)) {
|
||||
TRY(add_file(child_path));
|
||||
} else {
|
||||
TRY(handle_directory(child_path, handle_directory));
|
||||
|
@ -270,7 +270,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
};
|
||||
|
||||
for (auto const& path : paths) {
|
||||
if (Core::File::is_directory(path)) {
|
||||
if (Core::DeprecatedFile::is_directory(path)) {
|
||||
TRY(add_directory(path, add_directory));
|
||||
} else {
|
||||
TRY(add_file(path));
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*/
|
||||
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/GetPassword.h>
|
||||
#include <LibIMAP/Client.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
@ -38,7 +38,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (interactive_password) {
|
||||
password = TRY(Core::get_password());
|
||||
} else {
|
||||
auto standard_input = Core::File::standard_input();
|
||||
auto standard_input = Core::DeprecatedFile::standard_input();
|
||||
password = Core::SecretString::take_ownership(standard_input->read_all());
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <AK/GenericLexer.h>
|
||||
#include <AK/Time.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <LibTimeZone/TimeZone.h>
|
||||
|
@ -239,7 +239,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
atime.tv_nsec = UTIME_OMIT;
|
||||
|
||||
for (auto path : paths) {
|
||||
if (Core::File::exists(path)) {
|
||||
if (Core::DeprecatedFile::exists(path)) {
|
||||
if (utimensat(AT_FDCWD, path.characters(), times, 0) == -1)
|
||||
err("failed to touch '{}': {}", path, strerror(errno));
|
||||
} else if (!no_create_file) {
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibELF/Image.h>
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
#include <LibArchive/Zip.h>
|
||||
#include <LibCompress/Deflate.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/Directory.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibCrypto/Checksum/CRC32.h>
|
||||
|
@ -42,7 +42,7 @@ static bool unpack_zip_member(Archive::ZipMember zip_member, bool quiet)
|
|||
return true;
|
||||
}
|
||||
MUST(Core::Directory::create(LexicalPath(zip_member.name.to_deprecated_string()).parent(), Core::Directory::CreateDirectories::Yes));
|
||||
auto new_file = Core::File::construct(zip_member.name.to_deprecated_string());
|
||||
auto new_file = Core::DeprecatedFile::construct(zip_member.name.to_deprecated_string());
|
||||
if (!new_file->open(Core::OpenMode::WriteOnly)) {
|
||||
warnln("Can't write file {}: {}", zip_member.name, new_file->error_string());
|
||||
return false;
|
||||
|
@ -94,7 +94,7 @@ static bool unpack_zip_member(Archive::ZipMember zip_member, bool quiet)
|
|||
|
||||
if (checksum.digest() != zip_member.crc32) {
|
||||
warnln("Failed decompressing file {}: CRC32 mismatch", zip_member.name);
|
||||
MUST(Core::File::remove(zip_member.name, Core::File::RecursionMode::Disallowed));
|
||||
MUST(Core::DeprecatedFile::remove(zip_member.name, Core::DeprecatedFile::RecursionMode::Disallowed));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <AK/DeprecatedString.h>
|
||||
#include <LibCore/Account.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <unistd.h>
|
||||
|
@ -47,14 +47,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (access(target_account.home_directory().characters(), F_OK) == -1)
|
||||
return 0;
|
||||
|
||||
auto const real_path = Core::File::real_path_for(target_account.home_directory());
|
||||
auto const real_path = Core::DeprecatedFile::real_path_for(target_account.home_directory());
|
||||
|
||||
if (real_path == "/") {
|
||||
warnln("home directory is /, not deleted!");
|
||||
return 12;
|
||||
}
|
||||
|
||||
if (auto result = Core::File::remove(real_path, Core::File::RecursionMode::Allowed); result.is_error()) {
|
||||
if (auto result = Core::DeprecatedFile::remove(real_path, Core::DeprecatedFile::RecursionMode::Allowed); result.is_error()) {
|
||||
warnln("{}", result.release_error());
|
||||
return 12;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <LibCore/Account.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <pwd.h>
|
||||
|
@ -103,11 +103,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto maybe_error = Core::System::rename(target_account.home_directory(), new_home_directory);
|
||||
if (maybe_error.is_error()) {
|
||||
if (maybe_error.error().code() == EXDEV) {
|
||||
auto result = Core::File::copy_file_or_directory(
|
||||
auto result = Core::DeprecatedFile::copy_file_or_directory(
|
||||
new_home_directory, target_account.home_directory().characters(),
|
||||
Core::File::RecursionMode::Allowed,
|
||||
Core::File::LinkMode::Disallowed,
|
||||
Core::File::AddDuplicateFileMarker::No);
|
||||
Core::DeprecatedFile::RecursionMode::Allowed,
|
||||
Core::DeprecatedFile::LinkMode::Disallowed,
|
||||
Core::DeprecatedFile::AddDuplicateFileMarker::No);
|
||||
|
||||
if (result.is_error()) {
|
||||
warnln("usermod: could not move directory {} : {}", target_account.home_directory().characters(), static_cast<Error const&>(result.error()));
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
#include <AK/MemoryStream.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibLine/Editor.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <AK/Time.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/FileWatcher.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
@ -163,7 +163,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto file_watcher = Core::BlockingFileWatcher();
|
||||
for (auto const& file : files_to_watch) {
|
||||
if (!Core::File::exists(file)) {
|
||||
if (!Core::DeprecatedFile::exists(file)) {
|
||||
warnln("Cannot watch '{}', it does not exist.", file);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
@ -20,7 +20,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_positional_argument(filename, "Name of executable", "executable");
|
||||
args_parser.parse(arguments);
|
||||
|
||||
auto fullpath = Core::File::resolve_executable_from_environment({ filename, strlen(filename) });
|
||||
auto fullpath = Core::DeprecatedFile::resolve_executable_from_environment({ filename, strlen(filename) });
|
||||
if (!fullpath.has_value()) {
|
||||
warnln("no '{}' in path", filename);
|
||||
return 1;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <AK/URL.h>
|
||||
#include <AK/URLParser.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <LibXML/DOM/Document.h>
|
||||
|
@ -515,7 +515,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
parser.add_positional_argument(filename, "File to read from", "file");
|
||||
parser.parse(arguments);
|
||||
|
||||
s_path = Core::File::real_path_for(filename);
|
||||
s_path = Core::DeprecatedFile::real_path_for(filename);
|
||||
auto file = TRY(Core::Stream::File::open(s_path, Core::Stream::OpenMode::Read));
|
||||
auto contents = TRY(file->read_until_eof());
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
#include <LibCompress/Deflate.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DateTime.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibCrypto/Checksum/CRC32.h>
|
||||
|
@ -40,7 +40,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
DeprecatedString zip_file_path { zip_path };
|
||||
if (Core::File::exists(zip_file_path)) {
|
||||
if (Core::DeprecatedFile::exists(zip_file_path)) {
|
||||
if (force) {
|
||||
outln("{} already exists, overwriting...", zip_file_path);
|
||||
} else {
|
||||
|
@ -107,9 +107,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
Core::DirIterator it(path, Core::DirIterator::Flags::SkipParentAndBaseDir);
|
||||
while (it.has_next()) {
|
||||
auto child_path = it.next_full_path();
|
||||
if (Core::File::is_link(child_path))
|
||||
if (Core::DeprecatedFile::is_link(child_path))
|
||||
return {};
|
||||
if (!Core::File::is_directory(child_path)) {
|
||||
if (!Core::DeprecatedFile::is_directory(child_path)) {
|
||||
auto result = add_file(child_path);
|
||||
if (result.is_error())
|
||||
warnln("Couldn't add file '{}': {}", child_path, result.error());
|
||||
|
@ -123,7 +123,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
};
|
||||
|
||||
for (auto const& source_path : source_paths) {
|
||||
if (Core::File::is_directory(source_path)) {
|
||||
if (Core::DeprecatedFile::is_directory(source_path)) {
|
||||
auto result = add_directory(source_path, add_directory);
|
||||
if (result.is_error())
|
||||
warnln("Couldn't add directory '{}': {}", source_path, result.error());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue