From 4186f0eecd808faaa14a99d111b5aedcb3dec8f6 Mon Sep 17 00:00:00 2001 From: Paul Manias Date: Mon, 6 Jan 2025 17:44:02 +0000 Subject: [PATCH] [Core] Fixed issue with drive1: not being initialised correctly from the File class. --- src/core/classes/class_file.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/classes/class_file.cpp b/src/core/classes/class_file.cpp index 5dc8104b..09c0e613 100644 --- a/src/core/classes/class_file.cpp +++ b/src/core/classes/class_file.cpp @@ -701,9 +701,11 @@ static ERR FILE_Init(extFile *Self) #ifdef __unix__ // Establishing whether or not the path is a link is required on initialisation. struct stat64 info; - if (Self->prvResolvedPath.ends_with('/')) Self->prvResolvedPath.pop_back(); // For lstat64() symlink we need to remove the slash - if (lstat64(Self->prvResolvedPath.c_str(), &info) != -1) { // Prefer to get a stat on the link rather than the file it refers to - if (S_ISLNK(info.st_mode)) Self->Flags |= FL::LINK; + if (Self->prvResolvedPath != "/") { + if (Self->prvResolvedPath.ends_with('/')) Self->prvResolvedPath.pop_back(); // For lstat64() symlink we need to remove the slash + if (lstat64(Self->prvResolvedPath.c_str(), &info) != -1) { // Prefer to get a stat on the link rather than the file it refers to + if (S_ISLNK(info.st_mode)) Self->Flags |= FL::LINK; + } } #endif