Windows fixes.

This commit is contained in:
Scott Duensing 2023-11-26 21:13:33 -06:00
parent d0c4f1da8b
commit 4d325c447e
2 changed files with 16 additions and 1 deletions

View file

@ -29,6 +29,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <dirent.h> #include <dirent.h>
#include <sys/stat.h>
#include "include/archive.h" #include "include/archive.h"
#include "include/archive_entry.h" #include "include/archive_entry.h"
@ -875,6 +876,8 @@ void unpackGames(void) {
char *types[] = { "Game", "Tool", "Patch", 0 }; char *types[] = { "Game", "Tool", "Patch", 0 };
char *badFilenames[] = { "controls.dat", "Framework.singe", 0 }; char *badFilenames[] = { "controls.dat", "Framework.singe", 0 };
char *badExtensions[] = { "exe", "sh", "bat", "cmd", "index", 0 }; char *badExtensions[] = { "exe", "sh", "bat", "cmd", "index", 0 };
struct stat fileStat;
bool isFile;
// Games cannot include forbidden extensions, Singe binaries, multiple folders, etc. // Games cannot include forbidden extensions, Singe binaries, multiple folders, etc.
// Tools are like games but do not need a games.dat file. // 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."); if (dir == NULL) utilDie("Could not open the current directory.");
while ((de = readdir(dir)) != NULL) { 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; packageType = -1;
x = 0; x = 0;
while (types[x] != NULL) { while (types[x] != NULL) {

View file

@ -62,7 +62,9 @@
// Added by Scott Duensing to work with existing luasocket for Singe. // Added by Scott Duensing to work with existing luasocket for Singe.
#ifndef SOCKET_SELECT #ifndef SOCKET_SELECT
#ifndef _WIN32
#include <sys/poll.h> #include <sys/poll.h>
#endif
#define WAITFD_R POLLIN #define WAITFD_R POLLIN
#define WAITFD_W POLLOUT #define WAITFD_W POLLOUT
#define WAITFD_C (POLLIN|POLLOUT) #define WAITFD_C (POLLIN|POLLOUT)