diff options
author | Cameron Youell <cameronyouell@gmail.com> | 2023-03-22 02:35:30 +1100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-03-21 19:03:21 +0000 |
commit | 1d24f394c61d8e2af216c95303014d0554165f72 (patch) | |
tree | e577780754109c9b38a81cfc815d35f19c68eb9d /Meta | |
parent | edab0cbf41d80e805fe93ee0c4cc5021a1e599c1 (diff) | |
download | serenity-1d24f394c61d8e2af216c95303014d0554165f72.zip |
Everywhere: Use `LibFileSystem` where trivial
Diffstat (limited to 'Meta')
8 files changed, 27 insertions, 22 deletions
diff --git a/Meta/CMake/utils.cmake b/Meta/CMake/utils.cmake index 9970e87f72..76f4ef5ad5 100644 --- a/Meta/CMake/utils.cmake +++ b/Meta/CMake/utils.cmake @@ -122,7 +122,7 @@ if (NOT COMMAND serenity_test) add_dependencies(ComponentTests ${test_name}) set_target_properties(${test_name} PROPERTIES EXCLUDE_FROM_ALL TRUE) serenity_set_implicit_links(${test_name}) - target_link_libraries(${test_name} PRIVATE LibTest LibCore) + target_link_libraries(${test_name} PRIVATE LibTest LibCore LibFileSystem) foreach(lib ${SERENITY_TEST_LIBS}) target_link_libraries(${test_name} PRIVATE ${lib}) endforeach() @@ -135,7 +135,7 @@ function(serenity_testjs_test test_src sub_dir) if ("${SERENITY_TEST_CUSTOM_MAIN}" STREQUAL "") set(SERENITY_TEST_CUSTOM_MAIN "$<TARGET_OBJECTS:JavaScriptTestRunnerMain>") endif() - list(APPEND SERENITY_TEST_LIBS LibJS LibCore) + list(APPEND SERENITY_TEST_LIBS LibJS LibCore LibFileSystem) serenity_test(${test_src} ${sub_dir} CUSTOM_MAIN "${SERENITY_TEST_CUSTOM_MAIN}" LIBS ${SERENITY_TEST_LIBS}) diff --git a/Meta/Lagom/CMakeLists.txt b/Meta/Lagom/CMakeLists.txt index fcea6058f1..d7d9349995 100644 --- a/Meta/Lagom/CMakeLists.txt +++ b/Meta/Lagom/CMakeLists.txt @@ -251,7 +251,7 @@ function(lagom_test source) cmake_parse_arguments(LAGOM_TEST "" "WORKING_DIRECTORY" "LIBS" ${ARGN}) get_filename_component(name ${source} NAME_WE) add_executable(${name} ${source}) - target_link_libraries(${name} PRIVATE LibCore LibTest LibTestMain ${LAGOM_TEST_LIBS}) + target_link_libraries(${name} PRIVATE LibCore LibFileSystem LibTest LibTestMain ${LAGOM_TEST_LIBS}) add_test( NAME ${name} COMMAND ${name} @@ -346,6 +346,10 @@ target_sources(LibCore PRIVATE ${AK_SOURCES}) # LibMain add_serenity_subdirectory(Userland/Libraries/LibMain) +# LibFileSystem +# This is needed even if Lagom is not enabled because it is depended upon by code generators. +add_serenity_subdirectory(Userland/Libraries/LibFileSystem) + # LibTimeZone # This is needed even if Lagom is not enabled because it is depended upon by code generators. add_serenity_subdirectory(Userland/Libraries/LibTimeZone) @@ -524,7 +528,7 @@ if (BUILD_LAGOM) endif() add_executable(markdown-check ../../Userland/Utilities/markdown-check.cpp) - target_link_libraries(markdown-check LibMarkdown LibMain) + target_link_libraries(markdown-check LibFileSystem LibMarkdown LibMain) if (NOT EMSCRIPTEN) add_executable(ntpquery ../../Userland/Utilities/ntpquery.cpp) @@ -532,10 +536,10 @@ if (BUILD_LAGOM) endif() add_executable(sql ../../Userland/Utilities/sql.cpp) - target_link_libraries(sql LibCore LibIPC LibLine LibMain LibSQL) + target_link_libraries(sql LibCore LibFileSystem LibIPC LibLine LibMain LibSQL) add_executable(test262-runner ../../Tests/LibJS/test262-runner.cpp) - target_link_libraries(test262-runner LibJS LibCore) + target_link_libraries(test262-runner LibJS LibCore LibFileSystem) if (CMAKE_SYSTEM_NAME STREQUAL "Linux") include(CheckCSourceCompiles) @@ -554,7 +558,7 @@ if (BUILD_LAGOM) endif() add_executable(wasm ../../Userland/Utilities/wasm.cpp) - target_link_libraries(wasm LibCore LibWasm LibLine LibMain LibJS) + target_link_libraries(wasm LibCore LibFileSystem LibWasm LibLine LibMain LibJS) add_executable(xml ../../Userland/Utilities/xml.cpp) target_link_libraries(xml LibCore LibXML LibMain) @@ -567,7 +571,7 @@ if (BUILD_LAGOM) LibTest ${LIBTEST_SOURCES} ) - target_link_libraries(LibTest PRIVATE LibCore) + target_link_libraries(LibTest PRIVATE LibCore LibFileSystem) set_target_properties(LibTest PROPERTIES OUTPUT_NAME lagom-test) add_library( LibTestMain @@ -622,7 +626,7 @@ if (BUILD_LAGOM) add_executable(test-js ../../Tests/LibJS/test-js.cpp ../../Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp) - target_link_libraries(test-js LibCore LibTest LibJS) + target_link_libraries(test-js LibCore LibFileSystem LibTest LibJS) add_test( NAME JS COMMAND test-js --show-progress=false @@ -638,7 +642,7 @@ if (BUILD_LAGOM) add_executable(test-spreadsheet ../../Tests/Spreadsheet/test-spreadsheet.cpp ../../Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp) - target_link_libraries(test-spreadsheet LibCore LibTest LibJS) + target_link_libraries(test-spreadsheet LibCore LibFileSystem LibTest LibJS) add_test( NAME Spreadsheet COMMAND test-spreadsheet --show-progress=false @@ -649,7 +653,7 @@ if (BUILD_LAGOM) add_executable(test-wasm ../../Tests/LibWasm/test-wasm.cpp ../../Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp) - target_link_libraries(test-wasm LibCore LibTest LibWasm LibJS) + target_link_libraries(test-wasm LibCore LibFileSystem LibTest LibWasm LibJS) add_test( NAME WasmParser COMMAND test-wasm --show-progress=false ${CMAKE_CURRENT_BINARY_DIR}/Userland/Libraries/LibWasm/Tests diff --git a/Meta/Lagom/Tools/CMakeLists.txt b/Meta/Lagom/Tools/CMakeLists.txt index e81eff13de..3ef0940925 100644 --- a/Meta/Lagom/Tools/CMakeLists.txt +++ b/Meta/Lagom/Tools/CMakeLists.txt @@ -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 diff --git a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateLocaleData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateLocaleData.cpp index 8e55575b86..9fb8e78f03 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateLocaleData.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateLocaleData.cpp @@ -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)); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateNumberFormatData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateNumberFormatData.cpp index 5e7046ce48..b8a1d17501 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateNumberFormatData.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateNumberFormatData.cpp @@ -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)); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GeneratePluralRulesData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GeneratePluralRulesData.cpp index 2b24c31710..c0908738da 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GeneratePluralRulesData.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GeneratePluralRulesData.cpp @@ -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))); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp index 09a3dab1c0..e9adbab855 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp @@ -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)); diff --git a/Meta/Lagom/Tools/ConfigureComponents/main.cpp b/Meta/Lagom/Tools/ConfigureComponents/main.cpp index e356589b0c..4741b1da35 100644 --- a/Meta/Lagom/Tools/ConfigureComponents/main.cpp +++ b/Meta/Lagom/Tools/ConfigureComponents/main.cpp @@ -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; |