Merge branch '86Box:master' into pravetz16_imko4
This commit is contained in:
@@ -25,8 +25,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef _WIN32
|
||||
# include <string.h>
|
||||
# include <sys/types.h>
|
||||
#else
|
||||
# include <libgen.h>
|
||||
#endif
|
||||
@@ -131,6 +133,7 @@ static track_file_t *
|
||||
bin_init(const char *filename, int *error)
|
||||
{
|
||||
track_file_t *tf = (track_file_t *) malloc(sizeof(track_file_t));
|
||||
struct stat stats;
|
||||
|
||||
if (tf == NULL) {
|
||||
*error = 1;
|
||||
@@ -142,7 +145,11 @@ bin_init(const char *filename, int *error)
|
||||
tf->file = plat_fopen64(tf->fn, "rb");
|
||||
cdrom_image_backend_log("CDROM: binary_open(%s) = %08lx\n", tf->fn, tf->file);
|
||||
|
||||
*error = (tf->file == NULL);
|
||||
if (stat(tf->fn, &stats) != 0) {
|
||||
/* Use a blank structure if stat failed. */
|
||||
memset(&stats, 0, sizeof(struct stat));
|
||||
}
|
||||
*error = ((tf->file == NULL) || ((stats.st_mode & S_IFMT) == S_IFDIR));
|
||||
|
||||
/* Set the function pointers. */
|
||||
if (!*error) {
|
||||
|
@@ -38,6 +38,10 @@
|
||||
#include <86box/nvr.h>
|
||||
// clang-format on
|
||||
|
||||
#ifndef S_ISDIR
|
||||
# define S_ISDIR(m) (((m) &S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
|
||||
#define VISO_SKIP(p, n) \
|
||||
{ \
|
||||
memset(p, 0x00, n); \
|
||||
|
@@ -76,6 +76,10 @@ extern "C" {
|
||||
# define atomic_bool_t atomic_bool
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# define ssize_t intptr_t
|
||||
#endif
|
||||
|
||||
/* Global variables residing in the platform module. */
|
||||
extern int dopause, /* system is paused */
|
||||
mouse_capture; /* mouse is captured in app */
|
||||
|
@@ -17,6 +17,8 @@
|
||||
#ifndef PLAT_DIR_H
|
||||
#define PLAT_DIR_H
|
||||
|
||||
/* Windows needs the POSIX re-implementations */
|
||||
#if defined(_WIN32)
|
||||
#ifdef _MAX_FNAME
|
||||
# define MAXNAMLEN _MAX_FNAME
|
||||
#else
|
||||
@@ -63,5 +65,10 @@ extern void seekdir(DIR *, long);
|
||||
extern int closedir(DIR *);
|
||||
|
||||
#define rewinddir(dirp) seekdir(dirp, 0L)
|
||||
#else
|
||||
/* On linux and macOS, use the standard functions and types */
|
||||
#include <sys/dir.h>
|
||||
#endif
|
||||
|
||||
|
||||
#endif /*PLAT_DIR_H*/
|
||||
|
Reference in New Issue
Block a user