1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 20:17:44 +00:00

Everywhere: Use LibFileSystem where trivial

This commit is contained in:
Cameron Youell 2023-03-22 02:35:30 +11:00 committed by Linus Groh
parent edab0cbf41
commit 1d24f394c6
115 changed files with 275 additions and 228 deletions

View file

@ -3,7 +3,7 @@ function(lagom_tool tool)
add_executable(${tool} ${SOURCES} ${LAGOM_TOOL_SOURCES})
# alias for parity with exports
add_executable(Lagom::${tool} ALIAS ${tool})
target_link_libraries(${tool} LibCore ${LAGOM_TOOL_LIBS})
target_link_libraries(${tool} LibCore LibFileSystem ${LAGOM_TOOL_LIBS})
install(
TARGETS ${tool}
EXPORT LagomTargets

View file

@ -19,8 +19,8 @@
#include <AK/SourceGenerator.h>
#include <AK/StringBuilder.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/Directory.h>
#include <LibFileSystem/FileSystem.h>
static DeprecatedString format_identifier(StringView owner, DeprecatedString identifier)
{
@ -913,7 +913,7 @@ static ErrorOr<void> parse_all_locales(DeprecatedString bcp47_path, DeprecatedSt
{
LexicalPath core_supplemental_path(core_path);
core_supplemental_path = core_supplemental_path.append("supplemental"sv);
VERIFY(Core::DeprecatedFile::is_directory(core_supplemental_path.string()));
VERIFY(FileSystem::is_directory(core_supplemental_path.string()));
TRY(parse_core_aliases(core_supplemental_path.string(), cldr));
TRY(parse_likely_subtags(core_supplemental_path.string(), cldr));

View file

@ -23,8 +23,8 @@
#include <AK/Traits.h>
#include <AK/Utf8View.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/Directory.h>
#include <LibFileSystem/FileSystem.h>
#include <LibJS/Runtime/Intl/SingleUnitIdentifiers.h>
#include <LibLocale/Locale.h>
#include <LibLocale/NumberFormat.h>
@ -700,7 +700,7 @@ static ErrorOr<void> parse_all_locales(DeprecatedString core_path, DeprecatedStr
{
LexicalPath core_supplemental_path(move(core_path));
core_supplemental_path = core_supplemental_path.append("supplemental"sv);
VERIFY(Core::DeprecatedFile::is_directory(core_supplemental_path.string()));
VERIFY(FileSystem::is_directory(core_supplemental_path.string()));
TRY(parse_number_system_digits(core_supplemental_path.string(), cldr));

View file

@ -14,8 +14,8 @@
#include <AK/StringBuilder.h>
#include <AK/Variant.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/Directory.h>
#include <LibFileSystem/FileSystem.h>
#include <LibLocale/PluralRules.h>
static DeprecatedString format_identifier(StringView owner, DeprecatedString identifier)
@ -396,7 +396,7 @@ static ErrorOr<void> parse_all_locales(DeprecatedString core_path, DeprecatedStr
{
LexicalPath core_supplemental_path(move(core_path));
core_supplemental_path = core_supplemental_path.append("supplemental"sv);
VERIFY(Core::DeprecatedFile::is_directory(core_supplemental_path.string()));
VERIFY(FileSystem::is_directory(core_supplemental_path.string()));
auto remove_variants_from_path = [&](DeprecatedString path) -> ErrorOr<DeprecatedString> {
auto parsed_locale = TRY(CanonicalLanguageID::parse(cldr.unique_strings, LexicalPath::basename(path)));

View file

@ -12,8 +12,8 @@
#include <AK/StringUtils.h>
#include <AK/Types.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/Directory.h>
#include <LibFileSystem/FileSystem.h>
#include <LibUnicode/Emoji.h>
struct Emoji {
@ -47,7 +47,7 @@ static void set_image_path_for_emoji(StringView emoji_resource_path, EmojiData&
auto file = DeprecatedString::formatted("{}.png", builder.to_deprecated_string());
auto path = DeprecatedString::formatted("{}/{}", emoji_resource_path, file);
if (!Core::DeprecatedFile::exists(path))
if (!FileSystem::exists(path))
return;
emoji.image_path = emoji_data.unique_strings.ensure(move(file));
@ -396,7 +396,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
args_parser.add_option(emoji_resource_path, "Path to the /res/emoji directory", "emoji-resource-path", 'r', "emoji-resource-path");
args_parser.parse(arguments);
VERIFY(!emoji_resource_path.is_empty() && Core::DeprecatedFile::exists(emoji_resource_path));
VERIFY(!emoji_resource_path.is_empty() && FileSystem::exists(emoji_resource_path));
auto emoji_test_file = TRY(open_file(emoji_test_path, Core::File::OpenMode::Read));

View file

@ -13,6 +13,7 @@
#include <AK/Vector.h>
#include <LibCore/ConfigFile.h>
#include <LibCore/DeprecatedFile.h>
#include <LibFileSystem/FileSystem.h>
#include <spawn.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
@ -241,7 +242,7 @@ int main()
return 1;
}
if (!Core::DeprecatedFile::exists("components.ini"sv)) {
if (!FileSystem::exists("components.ini"sv)) {
warnln("\e[31mError:\e[0m There is no 'components.ini' in the current working directory.");
warnln(" It can be generated by running CMake with 'cmake ../.. -G Ninja'");
return 1;