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 /Userland/Libraries/LibJS | |
parent | edab0cbf41d80e805fe93ee0c4cc5021a1e599c1 (diff) | |
download | serenity-1d24f394c61d8e2af216c95303014d0554165f72.zip |
Everywhere: Use `LibFileSystem` where trivial
Diffstat (limited to 'Userland/Libraries/LibJS')
-rw-r--r-- | Userland/Libraries/LibJS/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/VM.cpp | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/Userland/Libraries/LibJS/CMakeLists.txt b/Userland/Libraries/LibJS/CMakeLists.txt index c08007f93c..d4ae494f21 100644 --- a/Userland/Libraries/LibJS/CMakeLists.txt +++ b/Userland/Libraries/LibJS/CMakeLists.txt @@ -265,4 +265,4 @@ set(SOURCES ) serenity_lib(LibJS js) -target_link_libraries(LibJS PRIVATE LibCore LibCrypto LibRegex LibSyntax LibLocale LibUnicode) +target_link_libraries(LibJS PRIVATE LibCore LibCrypto LibFileSystem LibRegex LibSyntax LibLocale LibUnicode) diff --git a/Userland/Libraries/LibJS/Runtime/VM.cpp b/Userland/Libraries/LibJS/Runtime/VM.cpp index b6e9857ee2..3ce4588b65 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.cpp +++ b/Userland/Libraries/LibJS/Runtime/VM.cpp @@ -13,6 +13,7 @@ #include <AK/String.h> #include <AK/StringBuilder.h> #include <LibCore/DeprecatedFile.h> +#include <LibFileSystem/FileSystem.h> #include <LibJS/AST.h> #include <LibJS/Interpreter.h> #include <LibJS/Runtime/AbstractOperations.h> @@ -854,18 +855,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::DeprecatedFile::exists(filename)) { + if (!FileSystem::exists(filename)) { for (auto extension : extensions) { // import "./foo" -> import "./foo.ext" auto resolved_filepath = DeprecatedString::formatted("{}.{}", filename, extension); - if (Core::DeprecatedFile::exists(resolved_filepath)) + if (FileSystem::exists(resolved_filepath)) return resolved_filepath; } - } else if (Core::DeprecatedFile::is_directory(filename)) { + } else if (FileSystem::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::DeprecatedFile::exists(resolved_filepath)) + if (FileSystem::exists(resolved_filepath)) return resolved_filepath; } } |