From ee5ad0e2a4cce0d7c6f35a178948fedbacc3a027 Mon Sep 17 00:00:00 2001 From: Garrett Brown Date: Mon, 22 Jun 2015 18:25:26 -0700 Subject: [PATCH] Attempt to fix compile on windows --- src/filesystem/IFileUtils.h | 22 ++++++++++++++-------- src/filesystem/vfs/VFSFileUtils.cpp | 18 ++++++++++++++++-- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/src/filesystem/IFileUtils.h b/src/filesystem/IFileUtils.h index c43165dd..943919dc 100644 --- a/src/filesystem/IFileUtils.h +++ b/src/filesystem/IFileUtils.h @@ -27,14 +27,20 @@ namespace JOYSTICK { struct STAT_STRUCTURE { - uint32_t deviceId; // ID of device containing file - uint64_t size; // Total size, in bytes - struct timespec accessTime; // Time of last access - struct timespec modificationTime; // Time of last modification - struct timespec statusTime; // Time of last status change - bool isDirectory; // The stat url is a directory - bool isSymLink; // The stat url is a symbolic link - bool isHidden; // The file is hidden + uint32_t deviceId; // ID of device containing file + uint64_t size; // Total size, in bytes +#if !defined(_WIN32) + timespec accessTime; // Time of last access + timespec modificationTime; // Time of last modification + timespec statusTime; // Time of last status change +#else + __time64_t accessTime; // Time of last access + __time64_t modificationTime; // Time of last modification + __time64_t statusTime; // Time of last status change +#endif + bool isDirectory; // The stat url is a directory + bool isSymLink; // The stat url is a symbolic link + bool isHidden; // The file is hidden }; class IFileUtils diff --git a/src/filesystem/vfs/VFSFileUtils.cpp b/src/filesystem/vfs/VFSFileUtils.cpp index f58a2da1..bd9a62e2 100644 --- a/src/filesystem/vfs/VFSFileUtils.cpp +++ b/src/filesystem/vfs/VFSFileUtils.cpp @@ -19,8 +19,10 @@ */ // This must be #defined before libXBMC_addon.h to fix compile -#include -#define __stat64 stat64 +#if !defined(_WIN32) + #include + #define __stat64 stat64 +#endif #include "VFSFileUtils.h" @@ -30,6 +32,14 @@ using namespace JOYSTICK; +#ifndef S_ISDIR + #define S_ISDIR(mode) ((((mode)) & 0170000) == (0040000)) +#endif + +#ifndef S_ISLNK + #define S_ISLNK(mode) ((((mode)) & 0170000) == (0120000)) +#endif + CVFSFileUtils::CVFSFileUtils(ADDON::CHelper_libXBMC_addon* frontend) : m_frontend(frontend) { @@ -52,6 +62,10 @@ bool CVFSFileUtils::Stat(const std::string& url, STAT_STRUCTURE& buffer) buffer.accessTime = frontendBuffer.st_atimespec; buffer.modificationTime = frontendBuffer.st_mtimespec; buffer.statusTime = frontendBuffer.st_ctimespec; +#elif defined(_WIN32) + buffer.accessTime = frontendBuffer.st_atime; + buffer.modificationTime = frontendBuffer.st_mtime; + buffer.statusTime = frontendBuffer.st_ctime; #else buffer.accessTime = frontendBuffer.st_atim; buffer.modificationTime = frontendBuffer.st_mtim;