mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 22:17:44 +00:00
Everywhere: Use LibFileSystem
where trivial
This commit is contained in:
parent
edab0cbf41
commit
1d24f394c6
115 changed files with 275 additions and 228 deletions
|
@ -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})
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
|
@ -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)));
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue