diff --git a/src/main.c b/src/main.c index 583517413..dbc739634 100644 --- a/src/main.c +++ b/src/main.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "include/archive.h" #include "include/archive_entry.h" @@ -875,6 +876,8 @@ void unpackGames(void) { char *types[] = { "Game", "Tool", "Patch", 0 }; char *badFilenames[] = { "controls.dat", "Framework.singe", 0 }; char *badExtensions[] = { "exe", "sh", "bat", "cmd", "index", 0 }; + struct stat fileStat; + bool isFile; // Games cannot include forbidden extensions, Singe binaries, multiple folders, etc. // Tools are like games but do not need a games.dat file. @@ -883,7 +886,17 @@ void unpackGames(void) { if (dir == NULL) utilDie("Could not open the current directory."); while ((de = readdir(dir)) != NULL) { - if (de->d_type == DT_REG || de->d_type == DT_LNK || de->d_type == DT_UNKNOWN) { + + isFile = false; + if ((strcmp(de->d_name, ".") != 0) && (strcmp(de->d_name, "..") != 0)) { + if (stat(de->d_name, &fileStat) == 0) { + if (S_ISREG(fileStat.st_mode) || S_ISLNK(fileStat.st_mode)) { + isFile = true; + } + } + } + + if (isFile) { packageType = -1; x = 0; while (types[x] != NULL) { diff --git a/thirdparty/luasec/src/compat.h b/thirdparty/luasec/src/compat.h index c93b9fa25..08c5bee0e 100644 --- a/thirdparty/luasec/src/compat.h +++ b/thirdparty/luasec/src/compat.h @@ -62,7 +62,9 @@ // Added by Scott Duensing to work with existing luasocket for Singe. #ifndef SOCKET_SELECT +#ifndef _WIN32 #include +#endif #define WAITFD_R POLLIN #define WAITFD_W POLLOUT #define WAITFD_C (POLLIN|POLLOUT)