mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 14:28:49 +00:00
LibGUI: Use Core::File::read_link()
This commit is contained in:
parent
eb7af00152
commit
0674d9362b
Notes:
sideshowbarker
2024-07-19 05:36:45 +09:00
Author: https://github.com/bugaevc
Commit: 0674d9362b
Pull-request: https://github.com/SerenityOS/serenity/pull/2564
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/awesomekling
1 changed files with 3 additions and 7 deletions
|
@ -27,6 +27,7 @@
|
|||
#include <AK/LexicalPath.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibGUI/FileSystemModel.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
|
@ -73,14 +74,9 @@ bool FileSystemModel::Node::fetch_data(const String& full_path, bool is_root)
|
|||
mtime = st.st_mtime;
|
||||
|
||||
if (S_ISLNK(mode)) {
|
||||
char buffer[PATH_MAX];
|
||||
int length = readlink(full_path.characters(), buffer, sizeof(buffer));
|
||||
if (length < 0) {
|
||||
symlink_target = Core::File::read_link(full_path);
|
||||
if (symlink_target.is_null())
|
||||
perror("readlink");
|
||||
} else {
|
||||
ASSERT(length > 0);
|
||||
symlink_target = String(buffer, length - 1);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue