Selaa lähdekoodia

LibGUI: Use Core::File::read_link()

Sergey Bugaev 5 vuotta sitten
vanhempi
commit
0674d9362b
1 muutettua tiedostoa jossa 3 lisäystä ja 7 poistoa
  1. 3 7
      Libraries/LibGUI/FileSystemModel.cpp

+ 3 - 7
Libraries/LibGUI/FileSystemModel.cpp

@@ -27,6 +27,7 @@
 #include <AK/LexicalPath.h>
 #include <AK/LexicalPath.h>
 #include <AK/StringBuilder.h>
 #include <AK/StringBuilder.h>
 #include <LibCore/DirIterator.h>
 #include <LibCore/DirIterator.h>
+#include <LibCore/File.h>
 #include <LibGUI/FileSystemModel.h>
 #include <LibGUI/FileSystemModel.h>
 #include <LibGUI/Painter.h>
 #include <LibGUI/Painter.h>
 #include <LibGfx/Bitmap.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;
     mtime = st.st_mtime;
 
 
     if (S_ISLNK(mode)) {
     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");
             perror("readlink");
-        } else {
-            ASSERT(length > 0);
-            symlink_target = String(buffer, length - 1);
-        }
     }
     }
 
 
     return true;
     return true;