#ifndef WINDOWS_COMPAT_H
#define WINDOWS_COMPAT_H

#ifdef _WIN32
    #include <io.h>
    #include <sys/stat.h>
    #include <direct.h>
    
    // Windows equivalents for POSIX functions
    #define access _access
    #define F_OK 0
    #define R_OK 4
    #define W_OK 2
    #define X_OK 1
    
    // For stat structure compatibility
    #ifndef S_ISREG
        #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
    #endif
    
    #ifndef S_ISDIR
        #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
    #endif
    
#else
    #include <unistd.h>
    #include <sys/stat.h>
#endif

#endif // WINDOWS_COMPAT_H