[Scummvm-git-logs] scummvm-tools master -> 62144547557ac990bf874998090d225a9f5cdb3f

aquadran noreply at scummvm.org
Thu Nov 18 23:02:29 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm-tools' repo located at https://github.com/scummvm/scummvm-tools .

Summary:
6214454755 GRIM: Replace dirent d_type with 'stat' IS_DIR


Commit: 62144547557ac990bf874998090d225a9f5cdb3f
    https://github.com/scummvm/scummvm-tools/commit/62144547557ac990bf874998090d225a9f5cdb3f
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2021-11-19T00:02:24+01:00

Commit Message:
GRIM: Replace dirent d_type with 'stat' IS_DIR

Changed paths:
    engines/grim/mklab.cpp


diff --git a/engines/grim/mklab.cpp b/engines/grim/mklab.cpp
index 8109b53..538dde3 100644
--- a/engines/grim/mklab.cpp
+++ b/engines/grim/mklab.cpp
@@ -79,12 +79,16 @@ void help() {
 
 static void countFiles(std::vector<std::string> &files, lab_header *head, DIR *dir, const std::string &d, std::string subdirn = "") {
 	struct dirent *dirfile;
+	struct stat st;
 	while ((dirfile = readdir(dir))) {
 		if (!strcmp(dirfile->d_name, ".") || !strcmp(dirfile->d_name, "..")) {
 			continue;
 		}
-
-		if (dirfile->d_type == DT_DIR) {
+		std::string dirname = d + "/" + dirfile->d_name;
+		if (stat(dirname.c_str(), &st) != 0) {
+			continue;
+		}
+		if (S_ISDIR(st.st_mode)) {
 			std::string nextsub = subdirn;
 			nextsub += dirfile->d_name;
 			nextsub += "/";




More information about the Scummvm-git-logs mailing list