mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:48:11 +00:00
LaunchServer: Prefer FileSystem over DeprecatedFile
This commit is contained in:
parent
e77f59b7d3
commit
85c897dc17
2 changed files with 12 additions and 6 deletions
|
@ -19,4 +19,4 @@ set(GENERATED_SOURCES
|
||||||
)
|
)
|
||||||
|
|
||||||
serenity_bin(LaunchServer)
|
serenity_bin(LaunchServer)
|
||||||
target_link_libraries(LaunchServer PRIVATE LibCore LibIPC LibDesktop LibMain)
|
target_link_libraries(LaunchServer PRIVATE LibCore LibIPC LibDesktop LibFileSystem LibMain)
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
#include <AK/LexicalPath.h>
|
#include <AK/LexicalPath.h>
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <LibCore/ConfigFile.h>
|
#include <LibCore/ConfigFile.h>
|
||||||
#include <LibCore/DeprecatedFile.h>
|
|
||||||
#include <LibCore/MimeData.h>
|
#include <LibCore/MimeData.h>
|
||||||
#include <LibCore/Process.h>
|
#include <LibCore/Process.h>
|
||||||
#include <LibDesktop/AppFile.h>
|
#include <LibDesktop/AppFile.h>
|
||||||
|
#include <LibFileSystem/FileSystem.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <serenity.h>
|
#include <serenity.h>
|
||||||
#include <spawn.h>
|
#include <spawn.h>
|
||||||
|
@ -303,16 +303,22 @@ void Launcher::for_each_handler_for_path(DeprecatedString const& path, Function<
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (S_ISLNK(st.st_mode)) {
|
if (S_ISLNK(st.st_mode)) {
|
||||||
auto link_target_or_error = Core::DeprecatedFile::read_link(path);
|
auto link_target_or_error = FileSystem::read_link(path);
|
||||||
if (link_target_or_error.is_error()) {
|
if (link_target_or_error.is_error()) {
|
||||||
perror("read_link");
|
perror("read_link");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto link_target = LexicalPath { link_target_or_error.release_value() };
|
auto link_target = LexicalPath { link_target_or_error.release_value().to_deprecated_string() };
|
||||||
LexicalPath absolute_link_target = link_target.is_absolute() ? link_target : LexicalPath::join(LexicalPath::dirname(path), link_target.string());
|
LexicalPath absolute_link_target = link_target.is_absolute() ? link_target : LexicalPath::join(LexicalPath::dirname(path), link_target.string());
|
||||||
auto real_path = Core::DeprecatedFile::real_path_for(absolute_link_target.string());
|
auto real_path_or_error = FileSystem::real_path(absolute_link_target.string());
|
||||||
return for_each_handler_for_path(real_path, [&](auto const& handler) -> bool {
|
if (real_path_or_error.is_error()) {
|
||||||
|
perror("real_path");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
auto real_path = real_path_or_error.release_value();
|
||||||
|
|
||||||
|
return for_each_handler_for_path(real_path.to_deprecated_string(), [&](auto const& handler) -> bool {
|
||||||
return f(handler);
|
return f(handler);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue