From 8c2cdb7bc772c5fdf764fffe4760d67711d5eb3e Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Sat, 13 May 2023 00:07:13 +0200 Subject: [PATCH] which: Prefer FileSystem over DeprecatedFile --- Userland/Utilities/CMakeLists.txt | 1 + Userland/Utilities/which.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Userland/Utilities/CMakeLists.txt b/Userland/Utilities/CMakeLists.txt index 9079887ebf..19ee1a8193 100644 --- a/Userland/Utilities/CMakeLists.txt +++ b/Userland/Utilities/CMakeLists.txt @@ -145,6 +145,7 @@ target_link_libraries(userdel PRIVATE LibFileSystem) target_link_libraries(wallpaper PRIVATE LibGfx LibGUI) target_link_libraries(wasm PRIVATE LibWasm LibLine LibJS) target_link_libraries(watch PRIVATE LibFileSystem) +target_link_libraries(which PRIVATE LibFileSystem) target_link_libraries(wsctl PRIVATE LibGUI LibIPC) target_link_libraries(xml PRIVATE LibXML) target_link_libraries(xzcat PRIVATE LibCompress) diff --git a/Userland/Utilities/which.cpp b/Userland/Utilities/which.cpp index c987a4d538..3407652cb2 100644 --- a/Userland/Utilities/which.cpp +++ b/Userland/Utilities/which.cpp @@ -5,8 +5,8 @@ */ #include -#include #include +#include #include #include @@ -20,8 +20,8 @@ ErrorOr serenity_main(Main::Arguments arguments) args_parser.add_positional_argument(filename, "Name of executable", "executable"); args_parser.parse(arguments); - auto fullpath = Core::DeprecatedFile::resolve_executable_from_environment(filename); - if (!fullpath.has_value()) { + auto fullpath = FileSystem::resolve_executable_from_environment(filename); + if (fullpath.is_error()) { warnln("no '{}' in path", filename); return 1; }