open: Prefer LibFileSystem over DeprecatedFile

This commit is contained in:
Ben Wiederhake 2023-05-20 01:40:19 +02:00 committed by Andreas Kling
parent 34eb797013
commit 6e08f860f8
Notes: sideshowbarker 2024-07-18 04:38:32 +09:00
2 changed files with 4 additions and 4 deletions

View file

@ -118,7 +118,7 @@ target_link_libraries(md PRIVATE LibMarkdown)
target_link_libraries(mv PRIVATE LibFileSystem)
target_link_libraries(network-settings PRIVATE LibCore LibMain)
target_link_libraries(notify PRIVATE LibGfx LibGUI)
target_link_libraries(open PRIVATE LibDesktop)
target_link_libraries(open PRIVATE LibDesktop LibFileSystem)
target_link_libraries(passwd PRIVATE LibCrypt)
target_link_libraries(paste PRIVATE LibGUI)
target_link_libraries(pledge PRIVATE LibFileSystem)

View file

@ -8,9 +8,9 @@
#include <AK/URL.h>
#include <AK/Vector.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/DeprecatedFile.h>
#include <LibCore/EventLoop.h>
#include <LibDesktop/Launcher.h>
#include <LibFileSystem/FileSystem.h>
#include <LibMain/Main.h>
ErrorOr<int> serenity_main(Main::Arguments arguments)
@ -25,8 +25,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
bool all_ok = true;
for (auto& url_or_path : urls_or_paths) {
auto path = Core::DeprecatedFile::real_path_for(url_or_path);
auto url = URL::create_with_url_or_path(path.is_null() ? url_or_path : path.view());
auto path = FileSystem::real_path(url_or_path);
auto url = URL::create_with_url_or_path(path.is_error() ? url_or_path : path.value());
if (!Desktop::Launcher::open(url)) {
warnln("Failed to open '{}'", url);