MSVC Support (#1199)
* fix stdalign and min/max for MSVC * add missing ISREG and ISDIR for MSVC * use MAX_PATH instead of PATH_MAX * remove unecessary headers inclusion * add MSVC CI * add appropriate macros to platform detection * re-add msvc CI artifacts * upload the generated artifacts * patch lua for MSVC CI builds * update patch for MSVC compatibility
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
#include "api.h"
|
||||
#include <SDL.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
|
||||
@@ -40,8 +40,8 @@ void deinit_dirmonitor(struct dirmonitor_internal* monitor) {
|
||||
|
||||
int translate_changes_dirmonitor(struct dirmonitor_internal* monitor, char* buffer, int buffer_size, int (*change_callback)(int, const char*, void*), void* data) {
|
||||
for (FILE_NOTIFY_INFORMATION* info = (FILE_NOTIFY_INFORMATION*)buffer; (char*)info < buffer + buffer_size; info = (FILE_NOTIFY_INFORMATION*)(((char*)info) + info->NextEntryOffset)) {
|
||||
char transform_buffer[PATH_MAX*4];
|
||||
int count = WideCharToMultiByte(CP_UTF8, 0, (WCHAR*)info->FileName, info->FileNameLength, transform_buffer, PATH_MAX*4 - 1, NULL, NULL);
|
||||
char transform_buffer[MAX_PATH*4];
|
||||
int count = WideCharToMultiByte(CP_UTF8, 0, (WCHAR*)info->FileName, info->FileNameLength, transform_buffer, MAX_PATH*4 - 1, NULL, NULL);
|
||||
change_callback(count, transform_buffer, data);
|
||||
if (!info->NextEntryOffset)
|
||||
break;
|
||||
|
||||
@@ -12,6 +12,20 @@
|
||||
#include <windows.h>
|
||||
#include <fileapi.h>
|
||||
#include "../utfconv.h"
|
||||
|
||||
// Windows does not define the S_ISREG and S_ISDIR macros in stat.h, so we do.
|
||||
// We have to define _CRT_INTERNAL_NONSTDC_NAMES 1 before #including sys/stat.h
|
||||
// in order for Microsoft's stat.h to define names like S_IFMT, S_IFREG, and S_IFDIR,
|
||||
// rather than just defining _S_IFMT, _S_IFREG, and _S_IFDIR as it normally does.
|
||||
#define _CRT_INTERNAL_NONSTDC_NAMES 1
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#if !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG)
|
||||
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
||||
#endif
|
||||
#if !defined(S_ISDIR) && defined(S_IFMT) && defined(S_IFDIR)
|
||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
#else
|
||||
|
||||
#include <dirent.h>
|
||||
|
||||
Reference in New Issue
Block a user